<style lang="less">
  .chest-pain-quality{
    width: 100%;
    height: calc(100vh - 50px);
    padding: 10px;
    .el-tabs{
      height: 100%;
    }
    .el-tabs__content{
      height: calc(100% - 56px);
    }
    .el-tab-pane{
      height: 100%;
    }
    .box-chose{
      height: 80px;
      padding-left: 30px;
      padding-top: 20px;
    }
    .box-echart{
      height: ~'calc(100% - 80px)';
      overflow: auto;
      background: #f0f2f5;
      padding: 20px 20px 0 20px;
      .box-card{
        width: 32%;
        height: 506px;
        display: inline-block;
        margin: 0 10px;
        .el-card__body{
          height: ~'calc(100% - 55px)';
        }
      }
    }
    .el-radio__label {
      line-height: 38px;
    }
    .prehospital-summary {
      width: 100%;
      height: 100%;
      &_content {
        height: calc(100% - 59px);
        overflow-y: auto;
      }
      .transferred-hospital {
        height: 400px;
      }
      .box-card+.box-card {
        margin-top: 5px;
      }
    }
    .treatment-process{
      width: 100%;
      height: 100%;
      &_content{
        height: calc(100% - 119px);
        overflow-y: auto;
      }
      .dignosis-content{
        width: 100%;
        height: 400px;
        display: inline-block;
        .dignosis-style{
          display: inline-block;
          width: 50%;
          height: 100%;
        }
      }
      .box-card + .box-card{
        margin-top: 5px;
      }
    }
  }
</style>

<template>
  <div class="chest-pain-quality">
    <el-form inline>
      <el-radio v-model="radioDate" label="1" @change="changeDate">
        <span style="margin-right: 5px;">指定日期</span>
        <el-form-item label="年份：">
          <el-date-picker
            v-model="year"
            type="year"
            value-format="yyyy"
            size="mini"
            :disabled="radioDate == 2"
            placeholder="选择年"
          />
        </el-form-item>
        <el-form-item label="季度：">
          <el-select v-model="quarter" size="mini" placeholder="请选择" :disabled="radioDate == 2">
            <el-option label="第一季度" :value="1" />
            <el-option label="第二季度" :value="2" />
            <el-option label="第三季度" :value="3" />
            <el-option label="第四季度" :value="4" />
          </el-select>
        </el-form-item>
        <el-form-item label="月份：">
          <el-select v-model="month" size="mini" placeholder="请选择" :disabled="radioDate == 2">
            <el-option label="一月" :value="1" :disabled="quarter != '' && quarter != '1'" />
            <el-option label="二月" :value="2" :disabled="quarter != '' && quarter != '1'" />
            <el-option label="三月" :value="3" :disabled="quarter != '' && quarter != '1'" />
            <el-option label="四月" :value="4" :disabled="quarter != '' && quarter != '2'" />
            <el-option label="五月" :value="5" :disabled="quarter != '' && quarter != '2'" />
            <el-option label="六月" :value="6" :disabled="quarter != '' && quarter != '2'" />
            <el-option label="七月" :value="7" :disabled="quarter != '' && quarter != '3'" />
            <el-option label="八月" :value="8" :disabled="quarter != '' && quarter != '3'" />
            <el-option label="九月" :value="9" :disabled="quarter != '' && quarter != '3'" />
            <el-option label="十月" :value="10" :disabled="quarter != '' && quarter != '4'" />
            <el-option label="十一月" :value="11" :disabled="quarter != '' && quarter != '4'" />
            <el-option label="十二月" :value="12" :disabled="quarter != '' && quarter != '4'" />
          </el-select>
        </el-form-item>
      </el-radio>
      <el-radio v-model="radioDate" label="2" @change="changeDate">
        <span style="margin-right: 5px;">其他时间</span>
        <el-form-item label="">
          <el-date-picker
            v-model="monthRange"
            type="monthrange"
            start-placeholder="开始月份"
            end-placeholder="结束月份"
            size="mini"
            format="yyyy-MM"
            value-format="yyyy-MM"
            :disabled="radioDate == 1"
          />
        </el-form-item>
      </el-radio>
      <el-form-item v-if="activeName == 'treatmentProcess' || activeName == 'reportSituation'" label="科室：">
        <el-select v-model="dept" placeholder="请选择" size="mini" @change="deptChange">
          <el-option
            v-for="(item, index) in deptList"
            :key="index"
            :label="item.name"
            :value="item.name"
          />
        </el-select>
      </el-form-item>
      <el-form-item v-if="activeName == 'treatmentProcess' || activeName == 'reportSituation'" label="人员：">
        <el-select v-model="doc" placeholder="请选择" size="mini">
          <el-option
            v-for="(item, index) in docList"
            :key="index"
            :label="item.name"
            :value="item.name"
          />
        </el-select>
      </el-form-item>
      <el-form-item v-if="activeName == 'officialIndicator'" label="">
        <el-select v-model="indicatorsPlaceholder" size="mini">
          <el-option v-for="(item, index) in timeList" v-show="false" :key="index" :label="item.label" :value="item.label" />
          <el-tree
            :data="data"
            show-checkbox
            :props="defaultProps"
            node-key="id"
            :default-checked-keys="defaultKeys"
            @check-change="handleCheckChange"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="">
        <el-button type="primary" size="mini" @click="search">搜索</el-button>
        <el-button size="mini" @click="reset">重置</el-button>
        <el-button type="primary" size="mini" @click="exportPPt">导出质控报告</el-button>
      </el-form-item>
    </el-form>
    <el-tabs v-model="activeName" type="card" style="height: calc(100% - 61px);" @tab-click="handleClick">
      <el-tab-pane label="院前概况" name="prehospitalSummary">
        <prehospital-summary
          v-if="activeName == 'prehospitalSummary'"
          ref="prehospitalSummary"
          :pre-year="year"
          :pre-quarter="quarter"
          :pre-month="month"
          :pre-month-range="monthRange"
        />
      </el-tab-pane>
      <el-tab-pane label="救治流程" name="treatmentProcess">
        <treatment-process
          v-if="activeName == 'treatmentProcess'"
          ref="treatmentProcess"
          :pre-year="year"
          :pre-quarter="quarter"
          :pre-month="month"
          :pre-month-range="monthRange"
          :pre-dept="dept"
          :pre-doc="doc"
        />
      </el-tab-pane>
      <el-tab-pane label="上报情况" name="reportSituation">
        <report-situation
          v-if="activeName == 'reportSituation'"
          ref="reportSituation"
          :pre-year="year"
          :pre-quarter="quarter"
          :pre-month="month"
          :pre-month-range="monthRange"
          :pre-dept="dept"
          :pre-doc="doc"
        />
      </el-tab-pane>
      <el-tab-pane label="官方指标" name="officialIndicator">
        <official-indicator
          v-if="activeName == 'officialIndicator'"
          ref="officialIndicator"
          :pre-year="year"
          :pre-quarter="quarter"
          :pre-month="month"
          :pre-month-range="monthRange"
          :pre-indicators="indicators"
        />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import prehospitalSummary from './components/prehospitalSummary'
import treatmentProcess from './components/treatmentProcess'
import reportSituation from './components/reportSituation'
import officialIndicator from './components/officialIndicator'
import {
  getHospitalTransfer,
  getTransferInNums,
  getTransferOutNums
} from '@/api/statistical/chest-pain'
import {
  getDiagMain,
  getDiagOther,
  getThromNumList,
  getPCIOpNumList,
  getDeptPCIOpNumList,
  getDeptAvgD2BRanking,
  getDirectDeptAvgD2BRanking,
  getAbnormalList,
  getD2BRanking
} from '@/api/statistical/chest-pain'

import {
  getDeptList,
  getDeptUserList,
  getUploadAvgMinutes,
  getUploadNums,
  getUploadQty,
  getUploadedQty,
  getDeptUploadNumRanking,
  getNotUploadList
} from '@/api/statistical/chest-pain'
// import { getStatisticChestPainCpc } from '@/api/statistical/statistical-analysis'
import { getCpcQcQuota, getCpcQuota } from '@/api/statistical/statistical-analysis'
// import echarts from 'echarts'
import createPPT from '@/utils/powerPoint/exportPowerPoint'
export default {
  name: 'ChestPainQuality',
  components: {
    prehospitalSummary,
    treatmentProcess,
    reportSituation,
    officialIndicator
  },
  data() {
    return {
      activeName: 'prehospitalSummary',
      radioDate: '1',
      year: '',
      quarter: '',
      month: '',
      dept: '',
      doc: '',
      tableInData: [],
      tableOutData: [],
      deptList: [],
      docList: [],
      indicatorsPlaceholder: '筛选指标',
      timeList: [{
        label: '季度',
        value: 'quarter'
      }, {
        label: '月度',
        value: 'month'
      }, {
        label: '年度',
        value: 'year'
      }],
      data: [{
        id: 1,
        label: '首次医疗接触至首份心电图（FMC2ECG）时间'
      }, {
        id: 2,
        label: '首份心电图至确诊时间'
      }, {
        id: 3,
        label: 'ECG远程传输比例'
      }, {
        id: 4,
        label: '从抽血完成到获取报告时间'
      }, {
        id: 5,
        label: '再灌注比例'
      }, {
        id: 6,
        label: '入门到导丝通过（D2B）时间'
      }, {
        id: 7,
        label: '首次医疗接触到导丝通过（FMC2B）时间'
      }, {
        id: 8,
        label: '导管室激活时间'
      }, {
        id: 9,
        label: '直达导管室比例"'
      }, {
        id: 10,
        label: '绕行CCU比例'
      }, {
        id: 11,
        label: '溶栓后患者24小时内早期造影的比例'
      }, {
        id: 12,
        label: '所有STEMI患者的死亡率'
      }, {
        id: 13,
        label: 'NSTEMI/UA的患者实施危险分层评估的比例'
      },
      {
        id: 14,
        label: '危险分层极高危的NSTEMI/UA患者2小时内实施紧急PCI的比例'
      },
      {
        id: 15,
        label: '危险分层高危的NSTEMI/UA患者24小时内实施早期介入治疗的比例'
      },
      {
        id: 16,
        label: '全部ACS患者院内死亡率'
      },
      {
        id: 17,
        label: '全部ACS患者院内心力衰竭发生率'
      },
      {
        id: 18,
        label: 'STEMI确诊至服用双抗药物时间'
      },
      {
        id: 19,
        label: 'STEMI患者从确诊到静脉肝素抗凝给药时间'
      },
      {
        id: 20,
        label: '到达医院大门到溶栓时间'
      },
      {
        id: 21,
        label: '首次医疗接触到溶栓时'
      },
      {
        id: 22,
        label: '网络医院的入门到出门的时间'
      },
      {
        id: 23,
        label: 'STEMI患者中呼叫120入院的比例'
      },
      {
        id: 24,
        label: 'STEMI患者发病后2小时内就诊的比例'
      },
      {
        id: 25,
        label: '通知CT室到CT室完成准备的时间'
      }
      ],
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      indicators: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],
      defaultKeys: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25],
      monthRange: [],
      tableDatayc: [],
      tableDatacq: [],
      chartData: [],
      rzChartData: [],
      ppt1: require('@/assets/ppt/ppt1.png'),
      ppt2: require('@/assets/ppt/ppt2.png'),
      ppt3: require('@/assets/ppt/ppt3.png'),
      ppt1_data: '',
      ppt2_data: '',
      ppt3_data: '',
      tableHeader1: ['时间范围', '医院名称', '转入病例数量(例)', '占比'],
      tableHeader2: ['时间范围', '医院名称', '转出病例数量(例)', '占比'],
      tableHeaderyc: ['序号', '患者姓名', '住院ID', '预警时间', '科室', '医生', '异常指标概述', '异常值'],
      tableHeadercq: ['序号', '患者姓名', '住院ID', '接诊时间', '入院时长', '当前科室', '当前医生'],
      dataAll: {
        qyzybltj: {// 全院转院病例统计
          chartType: '',
          labels: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: [],
            values: []
          }, {
            name: '',
            labels: [],
            values: []
          }]
        },
        qyzyblly: {// 全院转院病例来源统计
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        qyzyblly2: {// 全院转院病例去向统计
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),

          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        zdfbqktj: {// 1.诊断类型分布情况统计
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        qtfbqktj: {// 2.其他诊断类型分布情况
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        rsls: { // 3.溶栓例数（全院）
          chartType: '',
          labels: '',
          data2: [{
            name: '院前',
            labels: [],
            values: []
          }, {
            name: '院内',
            labels: [],
            values: []
          }]
        },
        pcibtcz: { // 4.PCI不同操作的手术治疗量统计
          chartType: '',
          labels: '',
          data2: [{
            name: '植入支架',
            labels: [],
            values: []
          }, {
            name: 'PTCA',
            labels: [],
            values: []
          }, {
            name: '冠脉内溶栓',
            labels: [],
            values: []
          }, {
            name: '血栓抽吸',
            labels: [],
            values: []
          }
          ]
        },
        sszllfb: {// 5.手术治疗量分布
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        zxlyD2Btime: {// 6.自行来院D2B平均时间排名
          chartType: '',
          labels: '',
          data: [{
            name: '分钟',
            labels: [],
            values: []
          }]
        },
        zxlyD2BshotTime: {// 7.自行来院D2B耗时最短病例（TOP5）
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        zxlyD2BlongTime: {// 8.自行来院D2B耗时最长病例（TOP5）
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        rxxlyD2Btime: { // 9.绕行病例D2B平均时间排名
          chartType: '',
          labels: '',
          data: [{
            name: '',
            labels: [],
            values: []
          }]
        },
        rxlyD2BshotTime: {// 10.绕行D2B耗时最短病例（TOP5）
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        rxlyD2BlongTime: {// 11.绕行D2B耗时最长病例（TOP5）
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        yczblist: {// 12.异常（超标/不达标）指标列表
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        sbwcslqs: { // 1.上报完成数量趋势图
          chartType: '',
          data: [{
            name: '上报完成数量',
            labels: [],
            values: []
          }]
        },
        sbpjhsqs: { // 2.上报平均耗时趋势图
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        tbqkfb: { // 3.填报情况分布图
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        zzsbqk: { // 4.最终上报情况分布图
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        kstblpm: { // 5.科室填报量排名
          chartType: '',
          labels: '',
          data: [{
            name: '',
            labels: [],
            values: []
          }]
        },
        ksjzsltj: { // 6.科室接诊数量统计
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        cqjdsbyj: { // 7.超期建档上报预警
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        }
      }
    }
  },
  mounted() {
    // this.treatmentProcess()
    if (this.activeName == 'prehospitalSummary') {
      this.$refs.prehospitalSummary.search()
    }
  },
  methods: {
    handleCheckChange(data, checked, indeterminate) {
      console.log(checked, 'checked')
      if (checked) {
        this.indicators.push(data.id)
      } else {
        this.indicators.splice(this.indicators.indexOf(data.id), 1)
      }
    },
    getDept() {
      this.deptList = []
      getDeptList({
        hospitalId: this.$store.getters.hospitalId
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            if (res.data.deptList && res.data.deptList.length > 0) {
              this.deptList = res.data.deptList
            }
          }
        }
      })
    },
    deptChange(val) {
      this.doc = ''
      this.docList = []
      getDeptUserList({
        hospitalId: this.$store.getters.hospitalId,
        departmentName: val
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            if (res.data.deptUserList && res.data.deptUserList.length > 0) {
              this.docList = res.data.deptUserList
            }
          }
        }
      })
    },
    handleClick(tab) {
      if (tab.name == 'prehospitalSummary') {
        this.$nextTick(() => {
          this.$refs.prehospitalSummary.search()
        })
      } else if (tab.name == 'treatmentProcess') {
        this.$nextTick(() => {
          this.$refs.treatmentProcess.search()
        })
      } else if (tab.name == 'reportSituation') {
        this.$nextTick(() => {
          this.$refs.reportSituation.search()
        })
      } else if (tab.name == 'officialIndicator') {
        this.$nextTick(() => {
          this.$refs.officialIndicator.search()
        })
      }
    },
    search() {
      if (this.activeName == 'prehospitalSummary') {
        this.$refs.prehospitalSummary.search()
      } else if (this.activeName == 'treatmentProcess') {
        this.$refs.treatmentProcess.search()
      } else if (this.activeName == 'reportSituation') {
        this.$refs.reportSituation.search()
      } else if (this.activeName == 'officialIndicator') {
        this.$refs.officialIndicator.search()
      }
    },
    reset() {
      this.radioDate = '1'
      this.year = ''
      this.quarter = ''
      this.month = ''
      this.monthRange = []
      this.dept = ''
      this.doc = ''
      this.docList = []
      this.indicators = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
      this.$nextTick(() => {
        if (this.activeName == 'prehospitalSummary') {
          this.$refs.prehospitalSummary.reset()
        } else if (this.activeName == 'treatmentProcess') {
          this.$refs.treatmentProcess.reset()
        } else if (this.activeName == 'reportSituation') {
          this.$refs.reportSituation.reset()
        } else if (this.activeName == 'officialIndicator') {
          this.$refs.officialIndicator.reset()
        }
      })
    },
    changeDate(val) {
      if (val == 1) {
        this.monthRange = []
      } else if (val == 2) {
        this.year = ''
        this.quarter = ''
        this.month = ''
      }
    },
    // 诊断类型分布情况统计
    getDiagnosis() {
      getDiagMain({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code === 0) {
          let diagMain = []
          if (res.data) {
            let stemiValue = 0
            let nstemiValue = 0
            let uaValue = 0
            let adValue = 0
            let peValue = 0
            let otherValue = 0
            let unknownValue = 0
            if (res.data.diagMainCount) {
              stemiValue = res.data.diagMainCount.diagSTEMI ? res.data.diagMainCount.diagSTEMI : 0
              nstemiValue = res.data.diagMainCount.diagNSTEMI ? res.data.diagMainCount.diagNSTEMI : 0
              uaValue = res.data.diagMainCount.diagUA ? res.data.diagMainCount.diagUA : 0
              adValue = res.data.diagMainCount.diagAD ? res.data.diagMainCount.diagAD : 0
              peValue = res.data.diagMainCount.diagPE ? res.data.diagMainCount.diagPE : 0
              otherValue = res.data.diagMainCount.diagOther ? res.data.diagMainCount.diagOther : 0
              unknownValue = res.data.diagMainCount.diagUnknown ? res.data.diagMainCount.diagUnknown : 0
              if (res.data.diagMainPercentage) {
                const stemiRate = res.data.diagMainPercentage.diagSTEMI ? res.data.diagMainPercentage.diagSTEMI : 0
                const nstemiRate = res.data.diagMainPercentage.diagNSTEMI ? res.data.diagMainPercentage.diagNSTEMI : 0
                const uaRate = res.data.diagMainPercentage.diagUA ? res.data.diagMainPercentage.diagUA : 0
                const adRate = res.data.diagMainPercentage.diagAD ? res.data.diagMainPercentage.diagAD : 0
                const peRate = res.data.diagMainPercentage.diagPE ? res.data.diagMainPercentage.diagPE : 0
                const otherRate = res.data.diagMainPercentage.diagOther ? res.data.diagMainPercentage.diagOther : 0
                const unknownRate = res.data.diagMainPercentage.diagUnknown ? res.data.diagMainPercentage.diagUnknown : 0
                diagMain = [
                  { value: stemiValue, name: 'STEMI', rate: stemiRate },
                  { value: nstemiValue, name: 'NSTEMI', rate: nstemiRate },
                  { value: uaValue, name: 'UA', rate: uaRate },
                  { value: adValue, name: '主动脉夹层', rate: adRate },
                  { value: peValue, name: '肺动脉栓塞', rate: peRate },
                  { value: otherValue, name: '其他', rate: otherRate },
                  { value: unknownValue, name: '未知', rate: unknownRate }
                ]
                this.dataAll.zdfbqktj.data1[0].labels = ['STEMI' + ':' + stemiValue, 'NSTEMI' + ':' + nstemiValue, 'UA' + ':' + uaValue, '主动脉夹层' + ':' + adValue, '肺动脉栓塞' + ':' + peValue, '其他' + ':' + otherValue, '未知' + ':' + unknownValue]
                this.dataAll.zdfbqktj.data1[0].values = [stemiValue, nstemiValue, uaValue, adValue, peValue, otherValue, unknownValue]
                this.dataAll.zdfbqktj.data2[0].values = [res.data.total]
              }
            }
          }
        } else {
        }
      })
    },
    getOtherDiagnosis() {
      getDiagOther({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code === 0) {
          let diagOther = []
          if (res.data) {
            let nacsValue = 0
            let otherValue = 0
            let awaitCPValue = 0
            let awaitCTValue = 0
            let undefinedValue = 0

            let nacsRate = 0
            let otherRate = 0
            let awaitCPRate = 0
            let awaitCTRate = 0
            let undefinedRate = 0
            if (res.data.diagOtherPercentage) {
              nacsRate = res.data.diagOtherPercentage.diagNACS ? res.data.diagOtherPercentage.diagNACS : 0
              otherRate = res.data.diagOtherPercentage.diagOther ? res.data.diagOtherPercentage.diagOther : 0
              awaitCPRate = res.data.diagOtherPercentage.diagAwaitCP ? res.data.diagOtherPercentage.diagAwaitCP : 0
              awaitCTRate = res.data.diagOtherPercentage.diagAwaitCT ? res.data.diagOtherPercentage.diagAwaitCT : 0
              undefinedRate = res.data.diagOtherPercentage.diagUndefined ? res.data.diagOtherPercentage.diagUndefined : 0
            }
            if (res.data.diagOtherCount) {
              nacsValue = res.data.diagOtherCount.diagNACS ? res.data.diagOtherCount.diagNACS : 0
              otherValue = res.data.diagOtherCount.diagOther ? res.data.diagOtherCount.diagOther : 0
              awaitCPValue = res.data.diagOtherCount.diagAwaitCP ? res.data.diagOtherCount.diagAwaitCP : 0
              awaitCTValue = res.data.diagOtherCount.diagAwaitCT ? res.data.diagOtherCount.diagAwaitCT : 0
              undefinedValue = res.data.diagOtherCount.diagUndefined ? res.data.diagOtherCount.diagUndefined : 0
              diagOther = [
                { value: nacsValue, name: '非ACS心源性胸痛', rate: nacsRate },
                { value: otherValue, name: '其它非心源性胸痛', rate: otherRate },
                { value: awaitCPValue, name: '胸痛待查', rate: awaitCPRate },
                { value: awaitCTValue, name: '胸闷待查', rate: awaitCTRate },
                { value: undefinedValue, name: '未明确诊断', rate: undefinedRate }
              ]
              this.dataAll.qtfbqktj.data1[0].labels = ['非ACS心源性胸痛' + ':' + nacsValue, '其它非心源性胸痛' + ':' + otherValue, '胸痛待查' + ':' + awaitCPValue, '胸闷待查' + ':' + awaitCTValue, '未明确诊断' + ':' + undefinedValue]
              this.dataAll.qtfbqktj.data1[0].values = [nacsValue, otherValue, awaitCPValue, awaitCTValue, undefinedValue]
              this.dataAll.qtfbqktj.data2[0].values = [res.data.total]
            } else {
            }
          }
        } else {
        }
      })
    },
    getThrombolysisCases() {
      getThromNumList({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code === 0) {
          const timeLine = []
          const thromList = []
          const preThromList = []
          if (res.data) {
            this.thrombolysisCasesTotal = res.data.totalAll ? res.data.totalAll : 0
            if (res.data.thromNumList && res.data.thromNumList.length > 0) {
              res.data.thromNumList.forEach(el => {
                const timeData = el.year + '-' + el.month
                timeLine.push(timeData)
                thromList.push(el.thromNum ? el.thromNum : 0)
                preThromList.push(el.preThromNum ? el.preThromNum : 0)
              })
              this.dataAll.rsls.labels = timeLine
              this.dataAll.rsls.data2[0].values = preThromList
              this.dataAll.rsls.data2[0].name = '院前:' + eval(preThromList.join('+'))
              this.dataAll.rsls.data2[0].labels = this.dataAll.rsls.labels
              this.dataAll.rsls.data2[1].values = thromList
              this.dataAll.rsls.data2[1].name = '院内:' + eval(thromList.join('+'))
              this.dataAll.rsls.data2[1].labels = this.dataAll.rsls.labels
            }
          }
        }
      })
    },
    getPciOperations() {
      getPCIOpNumList({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            this.pciOperationsTotal = res.data.total ? res.data.total : 0
            const timeLine = []
            const stentImplantationList = []
            const ptcaList = []
            const intracoronaryThromList = []
            const thrombusAspirationList = []
            let stentValue = 0
            let ptcaValue = 0
            let intracoronaryValue = 0
            let thromValue = 0
            let stentRate = 0
            let ptcaRate = 0
            let intracoronaryRate = 0
            let thromRate = 0
            let legendList = []
            if (res.data.pciOpSubTotal) {
              stentValue = res.data.pciOpSubTotal.numStentImplantation ? res.data.pciOpSubTotal.numStentImplantation : 0
              ptcaValue = res.data.pciOpSubTotal.numPTCA ? res.data.pciOpSubTotal.numPTCA : 0
              intracoronaryValue = res.data.pciOpSubTotal.numIntracoronaryThrom ? res.data.pciOpSubTotal.numIntracoronaryThrom : 0
              thromValue = res.data.pciOpSubTotal.numThrombusAspiration ? res.data.pciOpSubTotal.numThrombusAspiration : 0
            }
            if (res.data.pciOpPercentage) {
              stentRate = res.data.pciOpPercentage.numStentImplantation ? res.data.pciOpPercentage.numStentImplantation : 0
              ptcaRate = res.data.pciOpPercentage.numPTCA ? res.data.pciOpPercentage.numPTCA : 0
              intracoronaryRate = res.data.pciOpPercentage.numIntracoronaryThrom ? res.data.pciOpPercentage.numIntracoronaryThrom : 0
              thromRate = res.data.pciOpPercentage.numThrombusAspiration ? res.data.pciOpPercentage.numThrombusAspiration : 0
            }
            legendList = [{
              name: '植入支架',
              value: stentValue,
              rate: stentRate
            }, {
              name: 'PTCA',
              value: ptcaValue,
              rate: ptcaRate
            }, {
              name: '冠脉内溶栓',
              value: intracoronaryValue,
              rate: intracoronaryRate
            }, {
              name: '血栓抽吸',
              value: thromValue,
              rate: thromRate
            }]
            if (res.data.pciOpNumList && res.data.pciOpNumList.length > 0) {
              res.data.pciOpNumList.forEach(el => {
                const timeData = el.year + '-' + el.month
                timeLine.push(timeData)
                stentImplantationList.push(el.numStentImplantation ? el.numStentImplantation : 0)
                ptcaList.push(el.numPTCA ? el.numPTCA : 0)
                intracoronaryThromList.push(el.numIntracoronaryThrom ? el.numIntracoronaryThrom : 0)
                thrombusAspirationList.push(el.numThrombusAspiration ? el.numThrombusAspiration : 0)
              })
              this.dataAll.pcibtcz.labels = timeLine
              this.dataAll.pcibtcz.data2[0].values = stentImplantationList
              this.dataAll.pcibtcz.data2[0].labels = this.dataAll.pcibtcz.labels
              this.dataAll.pcibtcz.data2[0].name = '植入支架:' + eval(stentImplantationList.join('+'))
              this.dataAll.pcibtcz.data2[1].values = ptcaList
              this.dataAll.pcibtcz.data2[1].labels = this.dataAll.pcibtcz.labels
              this.dataAll.pcibtcz.data2[1].name = 'PTCA:' + eval(ptcaList.join('+'))
              this.dataAll.pcibtcz.data2[2].values = intracoronaryThromList
              this.dataAll.pcibtcz.data2[2].labels = this.dataAll.pcibtcz.labels
              this.dataAll.pcibtcz.data2[2].name = '冠脉内溶栓:' + eval(intracoronaryThromList.join('+'))
              this.dataAll.pcibtcz.data2[3].values = thrombusAspirationList
              this.dataAll.pcibtcz.data2[3].labels = this.dataAll.pcibtcz.labels
              this.dataAll.pcibtcz.data2[3].name = '血栓抽吸:' + eval(thrombusAspirationList.join('+'))
              // console.log(this.dataAll.pcibtcz,"this.dataAll.pcibtcz")
            } else {
            }
          }
        } else {
        }
      })
    },
    // 手术治疗量分布
    getSurgicalTreatment() {
      getDeptPCIOpNumList({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code === 0) {
          if (res.data) {
            this.surgicalTreatmentTotal = res.data.total ? res.data.total : 0
            const timeLine = []
            const stentImplantationList = []
            const ptcaList = []
            const intracoronaryThromList = []
            const thrombusAspirationList = []
            let stentValue = 0
            let ptcaValue = 0
            let intracoronaryValue = 0
            let thromValue = 0
            let stentRate = 0
            let ptcaRate = 0
            let intracoronaryRate = 0
            let thromRate = 0
            let legendList = []
            if (res.data.pciOpSubTotal) {
              stentValue = res.data.pciOpSubTotal.numStentImplantation ? res.data.pciOpSubTotal.numStentImplantation : 0
              ptcaValue = res.data.pciOpSubTotal.numPTCA ? res.data.pciOpSubTotal.numPTCA : 0
              intracoronaryValue = res.data.pciOpSubTotal.numIntracoronaryThrom ? res.data.pciOpSubTotal.numIntracoronaryThrom : 0
              thromValue = res.data.pciOpSubTotal.numThrombusAspiration ? res.data.pciOpSubTotal.numThrombusAspiration : 0
            }
            if (res.data.pciOpPercentage) {
              stentRate = res.data.pciOpPercentage.numStentImplantation ? res.data.pciOpPercentage.numStentImplantation : 0
              ptcaRate = res.data.pciOpPercentage.numPTCA ? res.data.pciOpPercentage.numPTCA : 0
              intracoronaryRate = res.data.pciOpPercentage.numIntracoronaryThrom ? res.data.pciOpPercentage.numIntracoronaryThrom : 0
              thromRate = res.data.pciOpPercentage.numThrombusAspiration ? res.data.pciOpPercentage.numThrombusAspiration : 0
            }
            legendList = [{
              name: '植入支架',
              value: stentValue,
              rate: stentRate
            }, {
              name: 'PTCA',
              value: ptcaValue,
              rate: ptcaRate
            }, {
              name: '冠脉内溶栓',
              value: intracoronaryValue,
              rate: intracoronaryRate
            }, {
              name: '血栓抽吸',
              value: thromValue,
              rate: thromRate
            }]
            if (res.data.deptPCIOpNumList && res.data.deptPCIOpNumList.length > 0) {
              res.data.deptPCIOpNumList.forEach(el => {
                timeLine.push(el.departmentName ? el.departmentName : 0)
                stentImplantationList.push(el.numStentImplantation ? el.numStentImplantation : 0)
                ptcaList.push(el.numPTCA ? el.numPTCA : 0)
                intracoronaryThromList.push(el.numIntracoronaryThrom ? el.numIntracoronaryThrom : 0)
                thrombusAspirationList.push(el.numThrombusAspiration ? el.numThrombusAspiration : 0)
              })
              let temp_data = []
              const sszHeader = ['科室名称', '植入支架', 'PTCA', '冠脉内溶栓', '血栓抽吸']
              for (let i = 0; i < sszHeader.length; i++) {
                temp_data.push({
                  text: sszHeader[i],
                  options: this.dataAll.sszllfb.options1
                })
              }
              this.dataAll.sszllfb.data.push(temp_data)
              let than_num = 10
              if (res.data.deptPCIOpNumList.length <= 5) {
                than_num = res.data.deptPCIOpNumList.length
              }
              for (let i = 0; i < than_num; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 0) {
                  temp_data.push({
                    text: res.data.deptPCIOpNumList[i].departmentName,
                    options: this.dataAll.sszllfb.options2
                  })
                  temp_data.push({
                    text: res.data.deptPCIOpNumList[i].numStentImplantation.toString(),
                    options: this.dataAll.sszllfb.options2
                  })
                  temp_data.push({
                    text: res.data.deptPCIOpNumList[i].numPTCA.toString(),
                    options: this.dataAll.sszllfb.options2
                  })
                  temp_data.push({
                    text: res.data.deptPCIOpNumList[i].numIntracoronaryThrom.toString(),
                    options: this.dataAll.sszllfb.options2
                  })
                  temp_data.push({
                    text: res.data.deptPCIOpNumList[i].numThrombusAspiration.toString(),
                    options: this.dataAll.sszllfb.options2
                  })
                } else {
                  temp_data.push({
                    text: res.data.deptPCIOpNumList[i].departmentName,
                    options: this.dataAll.sszllfb.options3
                  })
                  temp_data.push({
                    text: res.data.deptPCIOpNumList[i].numStentImplantation.toString(),
                    options: this.dataAll.sszllfb.options3
                  })
                  temp_data.push({
                    text: res.data.deptPCIOpNumList[i].numPTCA.toString(),
                    options: this.dataAll.sszllfb.options3
                  })
                  temp_data.push({
                    text: res.data.deptPCIOpNumList[i].numIntracoronaryThrom.toString(),
                    options: this.dataAll.sszllfb.options3
                  })
                  temp_data.push({
                    text: res.data.deptPCIOpNumList[i].numThrombusAspiration.toString(),
                    options: this.dataAll.sszllfb.options3
                  })
                }
                this.dataAll.sszllfb.data.push(temp_data)
              }
              // console.log(res.data.deptPCIOpNumList, "res.data.deptPCIOpNumList")
            } else {
            }
          }
        } else {
        }
      })
    },
    getD2BAverageTime() {
      getDeptAvgD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const d2bData = []
            if (res.data.deptAvgD2BRanking && res.data.deptAvgD2BRanking.length > 0) {
              res.data.deptAvgD2BRanking.forEach(el => {
                timeLine.push(el.departmentName ? el.departmentName : '')
                d2bData.push(el.avgD2B ? el.avgD2B : 0)
              })
              d2bData.sort((a, b) => { return b - a })
              this.dataAll.zxlyD2Btime.data[0].labels = timeLine
              this.dataAll.zxlyD2Btime.data[0].values = d2bData
              console.log(this.dataAll.zxlyD2Btime, 'this.dataAll.zxlyD2Btime')
            } else {
            }
          }
        } else {
        }
      })
    },
    getD2BCasesSort() {
      getD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc,
        type: 'shortest',
        isDirect: 0
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const docData = []
            const labelList = []
            if (res.data.d2bRanking && res.data.d2bRanking.length > 0) {
              res.data.d2bRanking.forEach(el => {
                timeLine.push(el.patientName ? el.patientName : '')
                docData.push(el.D2B ? el.D2B : 0)
                const docArr = []
                const d2bStr = '{a|' + (el.D2B ? el.D2B : 0) + '分钟}'
                docArr.push(d2bStr)
                if (el.doctorList && el.doctorList.length > 0) {
                  el.doctorList.forEach(docEl => {
                    const docStr = '{b|' + docEl + '}'
                    docArr.push(docStr)
                  })
                }
                labelList.push({
                  name: el.patientName ? el.patientName : '',
                  value: el.D2B ? el.D2B : 0,
                  doctorList: docArr
                })
              })

              // console.log(res.data.d2bRanking, "res.data.d2bRanking")
              let temp_data = []
              const zxlyD2BshotTimeHeader = ['患者姓名', 'D2B时间', '科室', '医生姓名', '排名']
              for (let i = 0; i < zxlyD2BshotTimeHeader.length; i++) {
                temp_data.push({
                  text: zxlyD2BshotTimeHeader[i],
                  options: this.dataAll.zxlyD2BshotTime.options1
                })
              }
              this.dataAll.zxlyD2BshotTime.data.push(temp_data)
              let than_num = 5
              if (res.data.d2bRanking.length <= 5) {
                than_num = res.data.d2bRanking.length
              }
              res.data.d2bRanking.sort((a, b) => { return a.D2B - b.D2B })
              for (let i = 0; i < than_num; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 0) {
                  temp_data.push({
                    text: res.data.d2bRanking[i].patientName,
                    options: this.dataAll.zxlyD2BshotTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].D2B,
                    options: this.dataAll.zxlyD2BshotTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[1].replace(')', ''),
                    options: this.dataAll.zxlyD2BshotTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[0],
                    options: this.dataAll.zxlyD2BshotTime.options2
                  })
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.zxlyD2BshotTime.options2
                  })
                } else {
                  temp_data.push({
                    text: res.data.d2bRanking[i].patientName,
                    options: this.dataAll.zxlyD2BshotTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].D2B,
                    options: this.dataAll.zxlyD2BshotTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[1].replace(')', ''),
                    options: this.dataAll.zxlyD2BshotTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[0],
                    options: this.dataAll.zxlyD2BshotTime.options3
                  })
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.zxlyD2BshotTime.options3
                  })
                }
                this.dataAll.zxlyD2BshotTime.data.push(temp_data)
              }
            } else {
            }
          }
        } else {
        }
      })
    },
    getD2BCasesLong() {
      getD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc,
        type: 'longest',
        isDirect: 0
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const docData = []
            const labelList = []
            if (res.data.d2bRanking && res.data.d2bRanking.length > 0) {
              res.data.d2bRanking.forEach(el => {
                timeLine.push(el.patientName ? el.patientName : '')
                docData.push(el.D2B ? el.D2B : 0)
                const docArr = []
                const d2bStr = '{a|' + (el.D2B ? el.D2B : 0) + '分钟}'
                docArr.push(d2bStr)
                if (el.doctorList && el.doctorList.length > 0) {
                  el.doctorList.forEach(docEl => {
                    const docStr = '{b|' + docEl + '}'
                    docArr.push(docStr)
                  })
                }
                labelList.push({
                  name: el.patientName ? el.patientName : '',
                  value: el.D2B ? el.D2B : 0,
                  doctorList: docArr
                })
              })

              let temp_data = []
              const zxlyD2BlongTimeHeader = ['患者姓名', 'D2B时间', '科室', '医生姓名', '排名']
              for (let i = 0; i < zxlyD2BlongTimeHeader.length; i++) {
                temp_data.push({
                  text: zxlyD2BlongTimeHeader[i],
                  options: this.dataAll.zxlyD2BlongTime.options1
                })
              }
              this.dataAll.zxlyD2BlongTime.data.push(temp_data)
              let than_num = 5
              if (res.data.d2bRanking.length <= 5) {
                than_num = res.data.d2bRanking.length
              }
              res.data.d2bRanking.sort((a, b) => { return b.D2B - a.D2B })
              for (let i = 0; i < than_num; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 0) {
                  temp_data.push({
                    text: res.data.d2bRanking[i].patientName,
                    options: this.dataAll.zxlyD2BlongTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].D2B,
                    options: this.dataAll.zxlyD2BlongTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[1].replace(')', ''),
                    options: this.dataAll.zxlyD2BlongTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[0],
                    options: this.dataAll.zxlyD2BlongTime.options2
                  })
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.zxlyD2BlongTime.options2
                  })
                } else {
                  temp_data.push({
                    text: res.data.d2bRanking[i].patientName,
                    options: this.dataAll.zxlyD2BlongTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].D2B,
                    options: this.dataAll.zxlyD2BlongTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[1].replace(')', ''),
                    options: this.dataAll.zxlyD2BlongTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[0],
                    options: this.dataAll.zxlyD2BlongTime.options3
                  })
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.zxlyD2BlongTime.options3
                  })
                }
                this.dataAll.zxlyD2BlongTime.data.push(temp_data)
              }
            } else {
            }
          }
        } else {
        }
      })
    },
    getDetourAverageTime() {
      getDirectDeptAvgD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const directData = []
            if (res.data.directDeptAvgD2BRanking && res.data.directDeptAvgD2BRanking.length > 0) {
              res.data.directDeptAvgD2BRanking.forEach(el => {
                timeLine.push(el.departmentName ? el.departmentName : '')
                directData.push(el.avgD2B ? el.avgD2B : 0)
              })
              directData.sort((a, b) => { return b - a })
              console.log(directData, 'directData')
              this.dataAll.rxxlyD2Btime.data[0].labels = timeLine
              this.dataAll.rxxlyD2Btime.data[0].values = directData
            } else {

            }
          }
        } else {
        }
      })
    },
    getDetourCasesSort() {
      getD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc,
        type: 'shortest',
        isDirect: 1
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const docData = []
            const labelList = []
            if (res.data.d2bRanking && res.data.d2bRanking.length > 0) {
              res.data.d2bRanking.forEach(el => {
                timeLine.push(el.patientName ? el.patientName : '')
                docData.push(el.D2B ? el.D2B : 0)
                const docArr = []
                const d2bStr = '{a|' + (el.D2B ? el.D2B : 0) + '分钟}'
                docArr.push(d2bStr)
                if (el.doctorList && el.doctorList.length > 0) {
                  el.doctorList.forEach(docEl => {
                    const docStr = '{b|' + docEl + '}'
                    docArr.push(docStr)
                  })
                }
                labelList.push({
                  name: el.patientName ? el.patientName : '',
                  value: el.D2B ? el.D2B : 0,
                  doctorList: docArr
                })
              })

              let temp_data = []
              const rxlyD2BshotTimeHeader = ['患者姓名', 'D2B时间', '科室', '医生姓名', '排名']
              for (let i = 0; i < rxlyD2BshotTimeHeader.length; i++) {
                temp_data.push({
                  text: rxlyD2BshotTimeHeader[i],
                  options: this.dataAll.rxlyD2BshotTime.options1
                })
              }
              this.dataAll.rxlyD2BshotTime.data.push(temp_data)
              let than_num = 5
              if (res.data.d2bRanking.length <= 5) {
                than_num = res.data.d2bRanking.length
              }
              res.data.d2bRanking.sort((a, b) => { return a.D2B - b.D2B })
              for (let i = 0; i < than_num; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 0) {
                  temp_data.push({
                    text: res.data.d2bRanking[i].patientName,
                    options: this.dataAll.rxlyD2BshotTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].D2B,
                    options: this.dataAll.rxlyD2BshotTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[1].replace(')', ''),
                    options: this.dataAll.rxlyD2BshotTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[0],
                    options: this.dataAll.rxlyD2BshotTime.options2
                  })
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.rxlyD2BshotTime.options2
                  })
                } else {
                  temp_data.push({
                    text: res.data.d2bRanking[i].patientName,
                    options: this.dataAll.rxlyD2BshotTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].D2B,
                    options: this.dataAll.rxlyD2BshotTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[1].replace(')', ''),
                    options: this.dataAll.rxlyD2BshotTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[0],
                    options: this.dataAll.rxlyD2BshotTime.options3
                  })
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.rxlyD2BshotTime.options3
                  })
                }
                this.dataAll.rxlyD2BshotTime.data.push(temp_data)
              }
            } else {
            }
          }
        } else {
        }
      })
    },
    getDetourCasesLong() {
      getD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc,
        type: 'longest',
        isDirect: 1
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const docData = []
            const labelList = []
            if (res.data.d2bRanking && res.data.d2bRanking.length > 0) {
              res.data.d2bRanking.forEach(el => {
                timeLine.push(el.patientName ? el.patientName : '')
                docData.push(el.D2B ? el.D2B : 0)
                const docArr = []
                const d2bStr = '{a|' + (el.D2B ? el.D2B : 0) + '分钟}'
                docArr.push(d2bStr)
                if (el.doctorList && el.doctorList.length > 0) {
                  el.doctorList.forEach(docEl => {
                    const docStr = '{b|' + docEl + '}'
                    docArr.push(docStr)
                  })
                }
                labelList.push({
                  name: el.patientName ? el.patientName : '',
                  value: el.D2B ? el.D2B : 0,
                  doctorList: docArr
                })
              })

              let temp_data = []
              const rxlyD2BlongTimeHeader = ['患者姓名', 'D2B时间', '科室', '医生姓名', '排名']
              for (let i = 0; i < rxlyD2BlongTimeHeader.length; i++) {
                temp_data.push({
                  text: rxlyD2BlongTimeHeader[i],
                  options: this.dataAll.rxlyD2BlongTime.options1
                })
              }
              this.dataAll.rxlyD2BlongTime.data.push(temp_data)
              let than_num = 5
              if (res.data.d2bRanking.length <= 5) {
                than_num = res.data.d2bRanking.length
              }
              res.data.d2bRanking.sort((a, b) => { return b.D2B - a.D2B })
              for (let i = 0; i < than_num; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 0) {
                  temp_data.push({
                    text: res.data.d2bRanking[i].patientName,
                    options: this.dataAll.rxlyD2BlongTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].D2B,
                    options: this.dataAll.rxlyD2BlongTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[1].replace(')', ''),
                    options: this.dataAll.rxlyD2BlongTime.options2
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[0],
                    options: this.dataAll.rxlyD2BlongTime.options2
                  })
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.rxlyD2BlongTime.options2
                  })
                } else {
                  temp_data.push({
                    text: res.data.d2bRanking[i].patientName,
                    options: this.dataAll.rxlyD2BlongTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].D2B,
                    options: this.dataAll.rxlyD2BlongTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[1].replace(')', ''),
                    options: this.dataAll.rxlyD2BlongTime.options3
                  })
                  temp_data.push({
                    text: res.data.d2bRanking[i].doctorList[0].split('(')[0],
                    options: this.dataAll.rxlyD2BlongTime.options3
                  })
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.rxlyD2BlongTime.options3
                  })
                }
                this.dataAll.rxlyD2BlongTime.data.push(temp_data)
              }
            } else {
            }
          }
        } else {

        }
      })
    },
    getTableData1() {
      this.tableDatayc = []
      getAbnormalList({
        hospitalId: this.$store.getters.hospitalId
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            if (res.data.statisticAbnormalList && res.data.statisticAbnormalList.length > 0) {
              this.tableDatayc = res.data.statisticAbnormalList

              let temp_data = []
              for (let i = 0; i < this.tableHeaderyc.length; i++) {
                temp_data.push(
                  {
                    text: this.tableHeaderyc[i],
                    options: this.dataAll.cqjdsbyj.options1
                  }
                )
              }
              this.dataAll.yczblist.data.push(temp_data)
              temp_data = []
              const than_num = this.tableDatayc.length
              // console.log(this.tableDatayc, "this.tableDatayc")
              for (let i = 0; i < than_num; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 0) {
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.yczblist.options2
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].patientName,
                    options: this.dataAll.yczblist.options2
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].inpatientNo,
                    options: this.dataAll.yczblist.options2
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].abnormalTime,
                    options: this.dataAll.yczblist.options2
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].deptName,
                    options: this.dataAll.yczblist.options2
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].doctorName,
                    options: this.dataAll.yczblist.options2
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].abTypeName,
                    options: this.dataAll.yczblist.options2
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].abnormalValue,
                    options: this.dataAll.yczblist.options2
                  })
                } else {
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.yczblist.options3
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].patientName,
                    options: this.dataAll.yczblist.options3
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].inpatientNo,
                    options: this.dataAll.yczblist.options3
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].abnormalTime,
                    options: this.dataAll.yczblist.options3
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].deptName,
                    options: this.dataAll.yczblist.options3
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].doctorName,
                    options: this.dataAll.yczblist.options3
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].abTypeName,
                    options: this.dataAll.yczblist.options3
                  })
                  temp_data.push({
                    text: this.tableDatayc[i].abnormalValue,
                    options: this.dataAll.yczblist.options3
                  })
                }
                this.dataAll.yczblist.data.push(temp_data)
              }
            }
          }
        }
      })
    },

    getReportedCompletedQuantity() {
      getUploadAvgMinutes({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const minutesList = []
            this.dataAll.sbpjhsqs.data = []
            if (res.data.uploadAvgMinutes && res.data.uploadAvgMinutes.length > 0) {
              res.data.uploadAvgMinutes.forEach(el => {
                const timeConcat = el.year + '-' + el.month
                timeLine.push(timeConcat)
                minutesList.push(el.uploadMinute ? el.uploadMinute : 0)
              })
              // this.dataAll.sbpjhsqs.data[0].labels = timeLine
              // this.dataAll.sbpjhsqs.data[0].values = minutesList
              const sbpjhsqs_header = ['月份', '平均耗时']
              let temp_data = []
              for (let i = 0; i < sbpjhsqs_header.length; i++) {
                temp_data.push(
                  {
                    text: sbpjhsqs_header[i],
                    options: this.dataAll.sbpjhsqs.options1
                  }
                )
              }
              this.dataAll.sbpjhsqs.data.push(temp_data)
              temp_data = []
              const than_num = minutesList.length
              for (let i = 0; i < than_num; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 0) {
                  temp_data.push({
                    text: timeLine[i],
                    options: this.dataAll.sbpjhsqs.options2
                  })
                  temp_data.push({
                    text: this.timeStamp(minutesList[i]),
                    options: this.dataAll.sbpjhsqs.options2
                  })
                } else {
                  temp_data.push({
                    text: timeLine[i],
                    options: this.dataAll.sbpjhsqs.options3
                  })
                  temp_data.push({
                    text: this.timeStamp(minutesList[i]),
                    options: this.dataAll.sbpjhsqs.options3
                  })
                }
                this.dataAll.sbpjhsqs.data.push(temp_data)
              }
            } else {
            }
          }
        } else {
        }
      })
    },
    getReportAveragetTime() {
      getUploadNums({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const uploadList = []
            if (res.data.uploadNums && res.data.uploadNums.length > 0) {
              res.data.uploadNums.forEach(el => {
                const timeConcat = el.year + '-' + el.month
                timeLine.push(timeConcat)
                uploadList.push(el.uploadNum ? el.uploadNum : 0)
              })
              this.dataAll.sbwcslqs.data[0].labels = timeLine
              this.dataAll.sbwcslqs.data[0].values = uploadList
              this.dataAll.sbwcslqs.data[0].name = '上报完成数量:' + eval(uploadList.join('+'))
            } else {

            }
          }
        } else {

        }
      })
    },
    getInformationFill() {
      getUploadQty({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            let notUploadValue = 0
            // let fillEndValue = 0
            let firstUploadValue = 0
            const auditUploadValue = 0
            // let notFillEndValue = 0

            let notUploadRate = 0
            // let fillEndRate = 0
            let firstUploadRate = 0
            const auditUploadRate = 0
            // let notFillEndRate = 0
            const summerTotal = 0
            let legendArr = []
            if (res.data.uploadQty && res.data.percentage) {
              if (res.data.uploadQty) {
                notUploadValue = res.data.uploadQty.numNotUpload ? res.data.uploadQty.numNotUpload : 0
                firstUploadValue = res.data.uploadQty.numFirstUpload ? res.data.uploadQty.numFirstUpload : 0
              }
              if (res.data.percentage) {
                notUploadRate = res.data.percentage.numNotUpload ? res.data.percentage.numNotUpload : 0
                firstUploadRate = res.data.percentage.numFirstUpload ? res.data.percentage.numFirstUpload : 0
              }
              legendArr = [{
                name: '未上报',
                value: notUploadValue,
                rate: notUploadRate
              },
              {
                name: '建档上报',
                value: firstUploadValue,
                rate: firstUploadRate
              }
              ]
              this.dataAll.tbqkfb.data1[0].labels = ['未上报' + ':' + notUploadValue, '建档上报' + ':' + firstUploadValue]
              this.dataAll.tbqkfb.data1[0].values = [notUploadValue, firstUploadValue]
              this.dataAll.tbqkfb.data2[0].values = [res.data.total]
            } else {
            }
          }
        } else {

        }
      })
    },
    getHaveBeenReported() {
      getUploadedQty({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            // let numFillEnd = 0
            let numFlowEnd = 0
            const numAwaitAuditUpload = 0
            const summerTotal = 0
            // let numFillEndRate = 0
            let numFlowEndRate = 0
            const numAwaitAuditUploadRate = 0
            let numAuditUpload = 0
            let numAuditUploadRate = 0
            let legendArr = []
            if (res.data.percentage && res.data.uploadedQty) {
              if (res.data.uploadedQty) {
                numFlowEnd = res.data.uploadedQty.numFlowEnd ? res.data.uploadedQty.numFlowEnd : 0
                numAuditUpload = res.data.uploadedQty.numAuditUpload ? res.data.uploadedQty.numAuditUpload : 0
              }
              if (res.data.percentage) {
                numFlowEndRate = res.data.percentage.numFlowEnd ? res.data.percentage.numFlowEnd : 0
                numAuditUploadRate = res.data.percentage.numAuditUpload ? res.data.percentage.numAuditUpload : 0
              }
              legendArr = [{
                name: '流程结束',
                value: numFlowEnd,
                rate: numFlowEndRate
              }, {
                name: '最终上报',
                value: numAuditUpload,
                rate: numAuditUploadRate
              }]

              this.dataAll.zzsbqk.data1[0].labels = ['最终上报' + ':' + numAuditUpload, '流程结束' + ':' + numFlowEnd]
              this.dataAll.zzsbqk.data1[0].values = [numAuditUpload, numFlowEnd]
              this.dataAll.zzsbqk.data2[0].values = [res.data.total]
            } else {

            }
          }
        } else {

        }
      })
    },
    getDeptFill() {
      getDeptUploadNumRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const uploadList = []
            if (res.data.deptUploadNums && res.data.deptUploadNums.length > 0) {
              res.data.deptUploadNums.forEach(el => {
                timeLine.push(el.departmentName ? el.departmentName : '')
                uploadList.push(el.uploadNum ? el.uploadNum : 0)
              })
              this.dataAll.kstblpm.data[0].labels = timeLine
              this.dataAll.kstblpm.data[0].values = uploadList
            } else {

            }
          }
        } else {

        }
      })
    },
    getTableData2() {
      this.tableDatacq = []
      getNotUploadList({
        hospitalId: this.$store.getters.hospitalId
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            if (res.data.overdueNotUploadList && res.data.overdueNotUploadList.length > 0) {
              this.tableDatacq = res.data.overdueNotUploadList

              let temp_data = []
              for (let i = 0; i < this.tableHeadercq.length; i++) {
                temp_data.push(
                  {
                    text: this.tableHeadercq[i],
                    options: this.dataAll.cqjdsbyj.options1
                  }
                )
              }
              this.dataAll.cqjdsbyj.data.push(temp_data)
              temp_data = []
              const than_num = this.tableDatacq.length
              for (let i = 0; i < than_num; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 0) {
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.cqjdsbyj.options2
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].patientName,
                    options: this.dataAll.cqjdsbyj.options2
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].inpatientNo,
                    options: this.dataAll.cqjdsbyj.options2
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].receptionTime,
                    options: this.dataAll.cqjdsbyj.options2
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].inpatientDays,
                    options: this.dataAll.cqjdsbyj.options2
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].currentDepartment,
                    options: this.dataAll.cqjdsbyj.options2
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].currentDoctor,
                    options: this.dataAll.cqjdsbyj.options2
                  })
                } else {
                  temp_data.push({
                    text: i + 1,
                    options: this.dataAll.cqjdsbyj.options3
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].patientName,
                    options: this.dataAll.cqjdsbyj.options3
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].inpatientNo,
                    options: this.dataAll.cqjdsbyj.options3
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].receptionTime,
                    options: this.dataAll.cqjdsbyj.options3
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].inpatientDays,
                    options: this.dataAll.cqjdsbyj.options3
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].currentDepartment,
                    options: this.dataAll.cqjdsbyj.options3
                  })
                  temp_data.push({
                    text: this.tableDatacq[i].currentDoctor,
                    options: this.dataAll.cqjdsbyj.options3
                  })
                }
                this.dataAll.cqjdsbyj.data.push(temp_data)
              }
            }
          }
        }
      })
    },
    // 质控指标
    getCpcQcQuota() {
    // getStatisticChestPainCpc() {
      // console.log("触发")
      // getStatisticChestPainCpc({
      getCpcQcQuota({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        indexes: this.indicators.join(',')
      }).then(res => {
        if (res.code === 0) {
          if (res.data && res.data.length > 0) {
            // res.data.forEach(el => {
            //   el.index = el.index - 1
            // })
            res.data.forEach((el) => {
              el.index = el.index - 1;
              let successRate = []  
              let timeData = []  
              let averageData = []
              successRate = el.optionData.map(rate=>{ 
                return rate.ratioReach
              })
              timeData = el.optionData.map(rate=> { return rate.timeName})
              averageData = el.optionData.map(rate=> { return rate.value})
              el.optionData = {
                successRate: successRate,
                timeData: timeData,
                averageData: averageData
              }
            })
          }
          this.chartData = res.data
          // console.log(this.chartData, 'this.chartData')
        }
      }).catch(() => {
      })
    },
    // 认证指标
    getCpcQuota() {
      // console.log("触发")
      getCpcQuota({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        indexes: this.indicators.join(',')
      }).then(res => {
        if (res.code === 0) {
          if (res.data && res.data.length > 0) {
            res.data.forEach((el) => {
                el.index = el.index - 1;
                let successRate = []  
                let timeData = []  
                let averageData = []
                successRate = el.optionData.map(rate=>{ 
                  return rate.ratioReach
                })
                timeData = el.optionData.map(rate=> { return rate.timeName})
                averageData = el.optionData.map(rate=> { return rate.value})
                el.optionData = {
                  successRate: successRate,
                  timeData: timeData,
                  averageData: averageData
                }
              });
          }
          this.rzChartData = res.data
        }
      }).catch(() => {})
    },
    treatmentProcess() {
      this.flushData()
      this.search()
      this.getTransferred()
      this.getTransferredCasesIn()
      this.getTransferredCasesOut()

      this.getDiagnosis()
      this.getOtherDiagnosis()
      this.getThrombolysisCases()
      this.getThrombolysisCases()
      this.getDetourAverageTime()
      this.getPciOperations()
      this.getSurgicalTreatment()
      this.getD2BAverageTime()
      this.getD2BCasesSort()
      this.getD2BCasesLong()
      this.getDetourCasesSort()
      this.getDetourCasesLong()
      this.getTableData1()

      this.getReportedCompletedQuantity()
      this.getReportAveragetTime()
      this.getInformationFill()
      this.getHaveBeenReported()
      this.getDeptFill()

      this.getTableData2()
      // this.getStatisticChestPainCpc()
      this.getCpcQcQuota()
      this.getCpcQuota()
    },
    exportPPt() {
      if (this.year === '' && this.monthRange.length == 0) {
        this.$message({
          message: '导出前请先选择年份!',
          type: 'warning'
        })
        return
      }
      this.treatmentProcess()
      const loading = this.$loading({
        lock: true, // lock的修改符--默认是false
        text: '正在导出', // 显示在加载图标下方的加载文案
        spinner: 'el-icon-loading', // 自定义加载图标类名
        // background: 'rgba(0, 0, 0, 0.7)', // 遮罩层颜色
        target: document.querySelector('#rootNode') // loadin覆盖的dom元素节点
      })
      const color_jjyzsj = ['4874cb']
      const color_jjyzcb = ['c23531']
      const color_jjyzsj_title = '993366'

      const color_qyzybl = ['ee822f', 'f2ba02']
      const color_lyfsfb = ['4874cb', 'ee822f', 'f2ba02', '30c0b4', '75bd42', 'e54c5e']
      const pptfile = new createPPT()
      pptfile.initPPt()
      this.fetchImage1(this.ppt1)
      this.fetchImage2(this.ppt2)
      this.fetchImage3(this.ppt3)
      setTimeout(() => {
        let exportTime = '未设置时间范围'
        if (this.monthRange.length == 2) {
          exportTime = this.monthRange[0] + '~' + this.monthRange[1]
        } else if (this.month || this.year || this.quarter) {
          let quarter_value
          let month_value

          if (this.month !== '') {
            month_value = '-' + this.month
          } else {
            month_value = '全年'
          }
          if (this.quarter != '' && this.month == '') {
            quarter_value = this.quarter
          } else if (this.quarter == '') {
            quarter_value = ''
          }
          switch (quarter_value) {
            case 1:
              quarter_value = '一'
              break
            case 2:
              quarter_value = '二'
              break
            case 3:
              quarter_value = '三'
              break
            case 4:
              quarter_value = '四'
              break
            default:
              break
          }
          exportTime = (this.year ? this.year + '年' : new Date().getFullYear() + '年') + (quarter_value ? quarter_value + '季度' : '') + (quarter_value ? ((month_value !== '' && month_value !== '全年') ? '-' + month_value + '月' : '') : (month_value === '全年' ? '-' + month_value : month_value + '月'))
        } else if (this.month == '' && this.year == '' && this.quarter == '') {
          exportTime = new Date().getFullYear() + '全年'
        }
        const tjzq = {
          text: '统计周期：' + exportTime,
          style: {
            x: '30%',
            y: '5%',
            fontFace: '仿宋', // 字体
            fontSize: 18, // 字号
            color: color_jjyzsj_title
          }
        }
        const zktitle = {
          text: '一、胸痛中心填报平台质控指标',
          style: {
            x: '30%',
            y: '10%',
            fontFace: '仿宋', // 字体
            fontSize: 13, // 字号
            color: '000000'
          }
        }

        const rztitle = {
          text: '二、胸痛中心填报平台认证指标',
          style: {
            x: '30%',
            y: '10%',
            fontFace: '仿宋', // 字体
            fontSize: 13, // 字号
            color: '000000'
          }
        }
        const sjly = {
          text: '数据来源：云智医胸痛中心系统V1.0',
          style: {
            x: '35%',
            y: '95%',
            bold: true,
            fontFace: '宋体', // 字体
            fontSize: 14, // 字号
            color: '898989'
          }
        }

        // console.log(tjzq, 'tjzq')
        // console.log(sjly, 'sjly')
        pptfile.ppt1 = this.ppt1_data
        pptfile.ppt2 = this.ppt2_data
        pptfile.ppt3 = this.ppt3_data
        const PPT1 = [
          {
            text: '胸痛数据报告',
            style: {
              x: '15%',
              y: '25%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 60, // 字号
              color: '1aa7ad'
            }
          },
          {
            text: '[' + this.$store.getters.hospitalName + ']',
            style: {
              x: '25%',
              y: '40%',
              bold: true,
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '7a3a7a'
            }
          },
          {
            text: '数据统计周期：' + exportTime,
            style: {
              x: '25%',
              y: '50%',
              bold: true,
              fontFace: '宋体', // 字体
              fontSize: 14, // 字号
              color: '000000'
            }
          },
          {
            text: '汇报方：心智医联(北京)科技有限公司',
            style: {
              x: '18%',
              y: '60%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: '7f7f7f'
            }
          }
        ]
        PPT1.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT1, 1)

        const PPT2 = [
          {
            text: '目录',
            style: {
              x: '15%',
              y: '25%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 54, // 字号
              color: '1aa7ad'
            }
          },
          {
            text: '院前概况\n救治流程\n上报情况\n官方指标',
            style: {
              x: '20%',
              y: '50%',
              fontFace: '黑体', // 字体
              fontSize: 24, // 字号
              color: '595959'
            }
          }
        ]
        PPT2.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT2, 2)

        const PPT3 = [
          {
            text: '一 院前概况',
            style: {
              x: '70%',
              y: '40%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 25, // 字号
              color: 'ffffff'

            }
          },
          {
            text: '转院病例统计\n转院情况分析',
            style: {
              x: '60%',
              y: '55%',
              fontFace: '黑体', // 字体
              fontSize: 18, // 字号
              color: 'ffffff',
              bullet: { code: '25B8' }
            }

          }
        ]
        PPT3.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT3, 3)

        const PPT4 = [
          {
            text: '1.全院转院病例统计（单位：例）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：转院病人总数=外院转入总数+本院转出总数',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT4.push(sjly)
        PPT4.push(tjzq)
        const opts4 = this.initOptCombo(color_qyzybl)
        pptfile.addPage()
        const combo4 = [
          {
            type: pptfile.pres.charts.BAR,
            data: [
              {
                name: '外院转入总数:' + eval(this.dataAll.qyzybltj.data2[0].values.join('+')),
                labels: this.dataAll.qyzybltj.labels,
                values: this.dataAll.qyzybltj.data2[0].values
              },
              {
                name: '本院转出总数:' + eval(this.dataAll.qyzybltj.data2[1].values.join('+')),
                labels: this.dataAll.qyzybltj.labels,
                values: this.dataAll.qyzybltj.data2[1].values
              }
            ],
            options: {
              chartColors: color_qyzybl,
              barGrouping: 'standard',
              dataLabelColor: '000000'
            }
          },
          {
            type: pptfile.pres.charts.LINE,
            data: [
              {
                name: '转院病人总数:' + eval(this.dataAll.qyzybltj.data1[0].values.join('+')),
                labels: this.dataAll.qyzybltj.labels,
                values: this.dataAll.qyzybltj.data1[0].values
              }
            ],
            options: {
              chartColors: ['4874cb'],
              dataLabelColor: '4874cb'
            }
          }
        ]
        pptfile.addText(PPT4, 2)
        pptfile.addCombo(combo4, opts4)
        const PPT5 = [
          {
            text: '2.全院转院病例来源统计',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT5.push(sjly)
        PPT5.push(tjzq)
        const opts5 = this.initOptsTable()
        pptfile.addPage()
        pptfile.addText(PPT5, 2)
        pptfile.addTable(this.dataAll.qyzyblly.data, opts5)

        const PPT6 = [

          {
            text: '3.全院转院病例去向统计',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT6.push(sjly)
        PPT6.push(tjzq)
        const opts6 = this.initOptsTable()
        pptfile.addPage()
        pptfile.addText(PPT6, 2)
        pptfile.addTable(this.dataAll.qyzyblly2.data, opts6)

        const PPT7 = [
          {
            text: '二 救治流程',
            style: {
              x: '70%',
              y: '35%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 25, // 字号
              color: 'ffffff'
            }
          },
          {
            text: '收治病人情况分析\n技术开展情况分析\n多维度D2B时间分析\n异常指标列表',
            style: {
              x: '60%',
              y: '51%',
              fontFace: '黑体', // 字体
              fontSize: 18, // 字号
              color: 'ffffff',
              bullet: { code: '25B8' }
            }
          }
        ]
        PPT7.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT7, 3)

        const PPT8 = [
          {
            text: '1.诊断类型分布情况统计（单位：例）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }, {
            text: '计算方式：统计诊断的类型分布和占比情况，其中非ACS心源性胸痛、其它非心源性胸痛、胸痛待查、胸闷待查、未明确诊断划分到“其他”，未填写计入“未知”',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT8.push(sjly)
        PPT8.push(tjzq)
        const opts8 = this.initOptsBar(color_jjyzsj, '15%')
        const opts8_2 = this.initOptsPie('', '595959', color_lyfsfb)
        pptfile.addPage()
        pptfile.addText(PPT8, 2)
        pptfile.addBar(this.dataAll.zdfbqktj.data2, opts8)
        pptfile.addPieDOUGHNUT(this.dataAll.zdfbqktj.data1, opts8_2)

        const PPT9 = [
          {
            text: '2.其他诊断类型分布情况（单位：例）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }, {
            text: '计算方式：划入“其他”类的详细诊断类型分布和占比情况',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT9.push(sjly)
        PPT9.push(tjzq)
        const opts9 = this.initOptsBar(color_jjyzsj, '15%')
        const opts9_2 = this.initOptsPie('', '595959', color_lyfsfb)
        pptfile.addPage()
        pptfile.addText(PPT9, 2)
        pptfile.addBar(this.dataAll.qtfbqktj.data2, opts9)
        pptfile.addPieDOUGHNUT(this.dataAll.qtfbqktj.data1, opts9_2)
        // 技术开展例数及占比
        const jskzbl = {
          text: '技术开展例数及占比',
          style: {
            x: '30%',
            y: '10%',
            fontFace: '仿宋', // 字体
            fontSize: 14, // 字号
            color: '595959'
          }
        }
        const PPT10 = [
          {
            text: '3.溶栓例数（全院）（单位：例）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT10.push(sjly)
        PPT10.push(tjzq)
        PPT10.push(jskzbl)

        const opts10 = this.initOptsBar(color_lyfsfb, '75%')
        pptfile.addPage()

        pptfile.addText(PPT10, 2)
        pptfile.addBar(this.dataAll.rsls.data2, opts10)

        const PPT11 = [
          {
            text: '4.PCI不同操作的手术治疗量统计（单位：例）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }
        ]
        PPT11.push(sjly)
        PPT11.push(tjzq)
        PPT11.push(jskzbl)

        const opts11 = this.initOptsBar(color_lyfsfb, '75%')
        pptfile.addPage()
        pptfile.addText(PPT11, 2)
        pptfile.addBar(this.dataAll.pcibtcz.data2, opts11)

        const PPT12 = [

          {
            text: '5.手术治疗量分布（单位：例）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：“术中处理”勾选“植入支架 PTCA 血栓抽吸 冠脉内溶栓”其中一项或多项时，取“介入医师”姓名及所在科室',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT12.push(sjly)
        PPT12.push(tjzq)
        const opts12 = this.initOptsTable()
        pptfile.addPage()
        pptfile.addText(PPT12, 2)
        pptfile.addTable(this.dataAll.sszllfb.data, opts12)

        const PPT13 = [
          {
            text: '6.自行来院D2B平均时间排名（单位：分钟）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：自行来院施行PCI手术的STEMI病例，入门至导丝通过时间的平均值',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT13.push(sjly)
        PPT13.push(tjzq)
        const opts13 = this.initOptsBarV('自行来院D2B平均时间', color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT13, 2)
        pptfile.addBar(this.dataAll.zxlyD2Btime.data, opts13)

        const PPT14 = [
          {
            text: '7.自行来院D2B耗时最短病例（TOP5）（单位：分钟）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：自行来院施行PCI手术的STEMI病例，入门至导丝通过最短耗时5个病例的排名，从短到长，以及对应的接诊医生和科室（仅统计急诊科及心内科）',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT14.push(sjly)
        PPT14.push(tjzq)
        const opts14 = this.initOptsTable()
        pptfile.addPage()
        pptfile.addText(PPT14, 2)
        pptfile.addTable(this.dataAll.zxlyD2BshotTime.data, opts14)

        const PPT15 = [
          {
            text: '8.自行来院D2B耗时最长病例（TOP5）（单位：分钟）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：自行来院施行PCI手术的STEMI病例，入门至导丝通过最长耗时5个病例的排名，从长到短，以及对应的接诊医生和科室（仅统计急诊科及心内科）',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT15.push(sjly)
        PPT15.push(tjzq)
        const opts15 = this.initOptsTable()
        pptfile.addPage()
        pptfile.addText(PPT15, 2)
        pptfile.addTable(this.dataAll.zxlyD2BlongTime.data, opts15)

        const PPT16 = [
          {
            text: '9.绕行病例D2B平均时间排名（单位：分钟）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：绕行急诊和CCU施行PCI手术的STEMI病例，入门至导丝通过时间的平均值',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT16.push(sjly)
        PPT16.push(tjzq)
        const opts16 = this.initOptsBarV('绕行来院D2B平均时间', color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT16, 2)
        pptfile.addBar(this.dataAll.rxxlyD2Btime.data, opts16)

        const PPT17 = [
          {
            text: '10.绕行D2B耗时最短病例（TOP5）（单位：分钟）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：绕行急诊和CCU施行PCI手术的STEMI病例，入门至导丝通过最长耗时5个病例的排名，从长到短，以及对应的接诊医生和科室（仅统计急诊科及心内科）',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT17.push(sjly)
        PPT17.push(tjzq)
        const opts17 = this.initOptsTable()
        pptfile.addPage()
        pptfile.addText(PPT17, 2)
        pptfile.addTable(this.dataAll.rxlyD2BshotTime.data, opts17)

        const PPT18 = [
          {
            text: '11.绕行D2B耗时最长病例（TOP5）（单位：分钟）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：绕行急诊和CCU施行PCI手术的STEMI病例，入门至导丝通过最长耗时5个病例的排名，从长到短，以及对应的接诊医生和科室（仅统计急诊科及心内科）',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 12, // 字号
              color: '800080'
            }
          }
        ]
        PPT18.push(sjly)
        PPT18.push(tjzq)
        const opts18 = this.initOptsTable()
        pptfile.addPage()
        pptfile.addText(PPT18, 2)
        pptfile.addTable(this.dataAll.rxlyD2BlongTime.data, opts18)
        const PPT19 = [
          {
            text: '12.异常（超标/不达标）指标列表',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：计算方式：展示指标结果相对与官网要求，属于异常（超标/不达标）的数据；预警时间为该异常值产生的时间。例如指标为一个时间差值，计算方式为A-B，当填写完后一个值的时候系统才能进行计算，异常值在此时产生，该时间即系统预警时间',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 10, // 字号
              color: '800080'
            }
          }
        ]
        PPT19.push(sjly)
        PPT19.push(tjzq)
        const opts19 = this.initOptsTable()
        if (this.dataAll.yczblist.data && this.dataAll.yczblist.data.length > 0) {
          const temp_length = parseInt((this.dataAll.yczblist.data.length - 1 > 0 ? this.dataAll.yczblist.data.length - 2 : 1) / 5) + 1
          // console.log(this.dataAll.yczblist.data, this.dataAll.yczblist.data.length, temp_length)
          for (let ii = 0; ii < temp_length; ii++) {
            pptfile.addPage()
            pptfile.addText(PPT19, 2)
            const temp_data = this.dataAll.yczblist.data.splice(1, 5)
            temp_data.unshift(this.dataAll.yczblist.data[0])
            pptfile.addTable(temp_data, opts19)
          }
        } else {
          pptfile.addPage()
          pptfile.addText(PPT19, 2)
        }
        const PPT20 = [
          {
            text: '三 上报情况',
            style: {
              x: '70%',
              y: '35%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 25, // 字号
              color: 'ffffff'
            }
          },
          {
            text: '上报数量及耗时趋势\n填报情况统计\n科室填报量排名\n超期建档上报预警',
            style: {
              x: '60%',
              y: '55%',
              fontFace: '黑体', // 字体
              fontSize: 18, // 字号
              color: 'ffffff',
              bullet: { code: '25B8' }
            }
          }
        ]
        PPT20.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT20, 3)

        const opts21 = this.initOpts('1.上报完成数量趋势图（单位：例）', color_jjyzsj_title, color_jjyzsj)
        const PPT21 = [
          {
            text: '计算方式：统计上报状态为建档上报的病例数量',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT21.push(sjly)
        PPT21.push(tjzq)
        pptfile.addPage()
        pptfile.addText(PPT21, 2)
        pptfile.addline(this.dataAll.sbwcslqs.data, opts21)

        // const opts22 = this.initOpts('2.上报平均耗时趋势图（单位：分钟）', color_jjyzsj_title, color_jjyzsj)
        const opts22 = this.initOptsTable()
        const PPT22 = [
          {
            text: '2.上报平均耗时趋势（单位：分钟）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：接诊时间和建档上报时间之差的平均值',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT22.push(sjly)
        PPT22.push(tjzq)
        pptfile.addPage()
        pptfile.addText(PPT22, 2)
        // pptfile.addline(this.dataAll.sbpjhsqs.data, opts22)
        pptfile.addTable(this.dataAll.sbpjhsqs.data, opts22)

        const PPT23 = [
          {
            text: '3.填报情况分布图（单位：例）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }, {
            text: '计算方式：“未上报”，取已在系统建档，但未在官网建档上报的病例；“建档上报”，取已在官网进行过建档上报的病例，包含建档上报、流程结束和最终上报的',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT23.push(sjly)
        PPT23.push(tjzq)
        const opts23 = this.initOptsBar(color_jjyzsj, '15%')
        const opts23_2 = this.initOptsPie('', '595959', color_lyfsfb)
        pptfile.addPage()
        pptfile.addText(PPT23, 2)
        pptfile.addBar(this.dataAll.tbqkfb.data2, opts23)
        pptfile.addPieDOUGHNUT(this.dataAll.tbqkfb.data1, opts23_2)

        const PPT24 = [
          {
            text: '4.最终上报情况分布图（单位：例）',
            style: {
              x: '25%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          }, {
            text: '计算方式：“流程结束”，取诊断为未明确诊断、非ACS心源性胸痛、其它非心源性胸痛、胸痛待查、胸闷待查的病例；“最终上报”，取在系统中进行“最终上报”的病例',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 10, // 字号
              color: '800080'
            }
          }
        ]
        PPT24.push(sjly)
        PPT24.push(tjzq)
        const opts24 = this.initOptsBar(color_jjyzsj, '15%')
        const opts24_2 = this.initOptsPie('', '595959', color_lyfsfb)
        pptfile.addPage()
        pptfile.addText(PPT24, 2)
        pptfile.addBar(this.dataAll.zzsbqk.data2, opts24)
        pptfile.addPieDOUGHNUT(this.dataAll.zzsbqk.data1, opts24_2)

        const PPT25 = [
          {
            text: '5.科室填报量排名（单位：例）',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：各科室建档病例数量统计',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 14, // 字号
              color: '800080'
            }
          }
        ]
        PPT25.push(sjly)
        PPT25.push(tjzq)
        const opts25 = this.initOptsBarV('科室填报量排名', color_jjyzsj, '75%')
        pptfile.addPage()
        pptfile.addText(PPT25, 2)
        pptfile.addBar(this.dataAll.kstblpm.data, opts25)

        // const PPT26 = [
        //   {
        //     text: '6.科室接诊数量统计（单位：例）',
        //     style: {
        //       x: '30%',
        //       y: '15%',
        //       bold: true,
        //       fontFace: 'Microsoft YaHei', // 字体
        //       fontSize: 14, // 字号
        //       color: color_jjyzsj_title
        //     }
        //   },
        //   {
        //     text: '计算方式：“初步诊断”已填写的病例，其中非ACS心源性胸痛、其它非心源性胸痛、胸痛待查、胸闷待查、未明确诊断划分到“其他”；取建档科室数据',
        //     style: {
        //       x: 1,
        //       y: '90%',
        //       fontFace: '仿宋', // 字体
        //       fontSize: 10, // 字号
        //       color: '800080'
        //     }
        //   }
        // ]
        // PPT26.push(sjly)
        // PPT26.push(tjzq)
        // const opts26 = this.initOptsTable()
        // pptfile.addPage()
        // pptfile.addText(PPT26, 2)
        // pptfile.addTable(this.dataAll.ksjzsltj.data, opts26)

        const PPT27 = [
          {
            text: '7.超期建档上报预警',
            style: {
              x: '30%',
              y: '15%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 14, // 字号
              color: color_jjyzsj_title
            }
          },
          {
            text: '计算方式：提示尚未按期进行建档上报的病例；取入院时长，由长到短排序，0~2天绿色（包含2天0小时），2~3天黄色（包含3天0小时），3天以上红色',
            style: {
              x: 1,
              y: '90%',
              fontFace: '仿宋', // 字体
              fontSize: 10, // 字号
              color: '800080'
            }
          }
        ]
        PPT27.push(sjly)
        PPT27.push(tjzq)
        const opts27 = this.initOptsTable()
        if (this.dataAll.cqjdsbyj.data && this.dataAll.cqjdsbyj.data.length > 0) {
          const temp_length = parseInt((this.dataAll.cqjdsbyj.data.length - 1 > 0 ? this.dataAll.cqjdsbyj.data.length - 2 : 1) / 10) + 1
          for (let ii = 0; ii < temp_length; ii++) {
            pptfile.addPage()
            pptfile.addText(PPT27, 2)
            const temp_data = this.dataAll.cqjdsbyj.data.splice(1, 10)
            temp_data.unshift(this.dataAll.cqjdsbyj.data[0])
            pptfile.addTable(temp_data, opts27)
          }
        } else {
          pptfile.addPage()
          pptfile.addText(PPT27, 2)
        }
        const PPT28 = [
          {
            text: '四 官方指标',
            style: {
              x: '70%',
              y: '40%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 25, // 字号
              color: 'ffffff'
            }
          },
          {
            // text: '胸痛中心填报平台关键指标',
            text: '胸痛中心填报平台质控指标\n胸痛中心填报平台认证指标',
            style: {
              x: '60%',
              y: '55%',
              fontFace: '黑体', // 字体
              fontSize: 18, // 字号
              color: 'ffffff',
              bullet: { code: '25B8' }
            }

          }
        ]
        PPT28.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT28, 3)
        // console.log(this.chartData, "chartData")
        for (let i = 0; i < this.chartData.length; i++) {
          const add_arr = [
            {
              text: (i + 1) + '.' + this.chartData[i].name + '（单位：' + this.chartData[i].optionData.unit + '）',
              style: {
                x: '25%',
                y: '15%',
                bold: true,
                fontFace: 'Microsoft YaHei', // 字体
                fontSize: 14, // 字号
                color: color_jjyzsj_title
              }
            }
          ]
          add_arr.push(sjly)
          add_arr.push(tjzq)
          if(i === 0){
            add_arr.push(zktitle)
          }
          pptfile.addPage()
          // console.log(this.chartData[i], 'this.chartData[i]')
          if (this.chartData[i].name.indexOf('死亡') === -1) {
            const opts_co = this.initOptCombo2(color_qyzybl, this.chartData[i].optionData.unit, '达标率（%）')
            const successData = this.chartData[i].optionData.successRate
            const combo_co = [
              {
                type: pptfile.pres.charts.BAR,
                data: [{
                  name: '指标值',
                  labels: this.chartData[i].optionData.timeData,
                  values: this.chartData[i].optionData.averageData
                }
                ],
                options: {
                  chartColors: (successData === null || (successData && successData >0))? color_jjyzsj:color_jjyzcb,
                  barGrouping: 'stacked',
                  dataLabelColor: '000000'
                }
              },
              {
                type: pptfile.pres.charts.LINE,
                data: [
                  {
                    name: '达标率',
                    labels: this.chartData[i].optionData.timeData,
                    values: this.chartData[i].optionData.successRate
                  }
                ],
                options: {
                  chartColors: ['F38940'], secondaryValAxis: true, secondaryCatAxis: true, dataLabelColor: 'F38940'
                }
              }
            ]

            pptfile.addText(add_arr, 2)
            // console.log({
            //   name: this.chartData[i].name,
            //   labels: this.chartData[i].optionData.timeData,
            //   values: this.chartData[i].optionData.targetData
            // })
            pptfile.addCombo(combo_co, opts_co)
          } else {
            const temp = { // 5.科室填报量排名
              chartType: '',
              labels: '',
              data: [{
                name: '指标值',
                labels: this.chartData[i].optionData.timeData,
                values: this.chartData[i].optionData.averageData
              }]
            }
            pptfile.addText(add_arr, 2)
            pptfile.addBar(temp.data, this.initOptsBar(color_jjyzsj, '75%', this.chartData[i].optionData.unit))
          }

          // pptfile.addBar([{
          //   name: this.chartData[i].name,
          //   labels: this.chartData[i].optionData.timeData,
          //   values: this.chartData[i].optionData.averageData
          // }], this.initOptsBar(color_jjyzsj, '75%'))
        }
        // 认证指标
        for (let i = 0; i < this.chartData.length; i++) {
          const add_arr = [
            {
              text: (i + 1) + '.' + this.chartData[i].name + '（单位：' + this.chartData[i].optionData.unit + '）',
              style: {
                x: '25%',
                y: '15%',
                bold: true,
                fontFace: 'Microsoft YaHei', // 字体
                fontSize: 14, // 字号
                color: color_jjyzsj_title
              }
            }
          ]
          add_arr.push(sjly)
          add_arr.push(tjzq)
          if(i === 0){
            add_arr.push(rztitle)
          }
          pptfile.addPage()
          // console.log(this.chartData[i], 'this.chartData[i]')
          if (this.chartData[i].name.indexOf('死亡') === -1) {
            const opts_co = this.initOptCombo2(color_qyzybl, this.chartData[i].optionData.unit, '达标率（%）')
            const successData = this.chartData[i].optionData.successRate
            const combo_co = [
              {
                type: pptfile.pres.charts.BAR,
                data: [{
                  name: '指标值',
                  labels: this.chartData[i].optionData.timeData,
                  values: this.chartData[i].optionData.averageData
                }
                ],
                options: {
                  // chartColors: color_jjyzsj,
                  chartColors: (successData === null || (successData && successData >0))? color_jjyzsj:color_jjyzcb,
                  barGrouping: 'stacked',
                  dataLabelColor: '000000'
                }
              },
              {
                type: pptfile.pres.charts.LINE,
                data: [
                  {
                    name: '达标率',
                    labels: this.chartData[i].optionData.timeData,
                    values: this.chartData[i].optionData.successRate
                  }
                ],
                options: {
                  chartColors: ['F38940'], secondaryValAxis: true, secondaryCatAxis: true, dataLabelColor: 'F38940'
                }
              }
            ]

            pptfile.addText(add_arr, 2)
            // console.log({
            //   name: this.chartData[i].name,
            //   labels: this.chartData[i].optionData.timeData,
            //   values: this.chartData[i].optionData.targetData
            // })
            pptfile.addCombo(combo_co, opts_co)
          } else {
            const temp = { // 5.科室填报量排名
              chartType: '',
              labels: '',
              data: [{
                name: '指标值',
                labels: this.chartData[i].optionData.timeData,
                values: this.chartData[i].optionData.averageData
              }]
            }
            pptfile.addText(add_arr, 2)
            pptfile.addBar(temp.data, this.initOptsBar(color_jjyzsj, '75%', this.chartData[i].optionData.unit))
          }

          // pptfile.addBar([{
          //   name: this.chartData[i].name,
          //   labels: this.chartData[i].optionData.timeData,
          //   values: this.chartData[i].optionData.averageData
          // }], this.initOptsBar(color_jjyzsj, '75%'))
        }

        const PPT39 = [
          {
            text: '谢 谢！',
            style: {
              x: '65%',
              y: '45%',
              bold: true,
              fontFace: 'Microsoft YaHei', // 字体
              fontSize: 54, // 字号
              color: 'ffffff'
            }
          }
        ]

        PPT39.push(sjly)
        pptfile.addPage()
        pptfile.addText(PPT39, 3)

        pptfile.exportPowerPoint('胸痛质控报告 ' + exportTime).then(() => {
          console.log('导出完毕')
          loading.close()
        })
      }, 4000)
      setTimeout(() => {
        loading.close()
      }, 60000)
    },
    initOpts(title, titleColor, chartColors) {
      return {
        x: 1,
        y: 0.6,
        w: '75%',
        h: '80%',
        barDir: 'col',
        dataBorder: { pt: '0.2', color: 'eeeeee' },	// 柱状图柱子边框线
        catAxisLabelColor: '595959', // 横轴刻度字体颜色
        valAxisLabelColor: '595959', // 纵轴刻度字体颜色
        catAxisLabelFontSize: 8,	// 横轴刻度字体大小
        valAxisLabelFontSize: 8,	// 纵轴刻度字体大小
        showLegend: true,	// 展示legend 就是一个小颜色块，戳一下可以控制对应数据的显示隐藏的那个东西
        legendColor: '595959', // legend颜色
        legendFontSize: 8,	// legend字体
        legendPos: 'b',	// legend位置 b 是底部，t 是顶部
        showTitle: true,	// 展示标题
        titleColor: titleColor, // 标题颜色
        titleAlign: 'center', // 标题左右居中
        titleFontSize: 24, // 标题字体
        valGridLine: { pt: '0.2', color: 'eeeeee' }, // y轴网格刻度线
        title: title, // 标题
        chartColors: chartColors, // 柱状图颜色列表
        barGapWidthPct: 1500, // 柱状图宽度，最大500，这里除一下数组宽度,不然可能会矮矮胖胖
        showValue: true, // 是否展示数值
        dataLabelColor: '595959', // 数值字体颜色
        dataLabelFontFace: 'Microsoft YaHei', // 数值字体
        dataLabelFontSize: 6,	 // 数值字体大小
        dataLabelPosition: 'outEnd' // 数值出现位置
      }
    },
    initOptsBar(chartColors, width, v_title) {
      return {
        x: 1,
        y: 1.2,
        w: width,
        h: 3.4,
        barDir: 'col',
        dataBorder: { pt: '0.2', color: 'eeeeee' },	// 柱状图柱子边框线
        catAxisLabelColor: '595959', // 横轴刻度字体颜色
        valAxisLabelColor: '595959', // 纵轴刻度字体颜色
        catAxisLabelFontSize: 8,	// 横轴刻度字体大小
        valAxisLabelFontSize: 8,	// 纵轴刻度字体大小
        legendColor: '595959', // legend颜色
        legendFontSize: 8,	// legend字体
        legendPos: 'b',	// legend位置 b 是底部，t 是顶部
        valGridLine: { pt: '0.2', color: 'eeeeee' }, // y轴网格刻度线
        showLegend: true,
        chartColors: chartColors, // 柱状图颜色列表
        showValue: true, // 是否展示数值
        dataLabelColor: '595959', // 数值字体颜色
        dataLabelFontFace: 'Microsoft YaHei', // 数值字体
        dataLabelFontSize: 4,	 // 数值字体大小
        dataLabelPosition: 'outEnd', // 数值出现位置
        showValAxisTitle: !!v_title,
        valAxisTitle: v_title,
        valAxisTitleColor: '1982c4',
        valAxisLabelColor: '1982c4'
      }
    },
    initOptsBarV(title, chartColors, width) {
      return {
        x: 1,
        y: 1.2,
        w: width,
        h: 3.4,
        barDir: 'bar',
        dataBorder: { pt: '0.2', color: 'eeeeee' },	// 柱状图柱子边框线
        catAxisLabelColor: '595959', // 横轴刻度字体颜色
        valAxisLabelColor: '595959', // 纵轴刻度字体颜色
        // catAxisHidden: true,
        valGridLine: { style: 'none' },
        valAxisHidden: true,
        title: title, // 标题
        showLegend: true,
        catAxisLabelFontSize: 8,	// 横轴刻度字体大小
        valAxisLabelFontSize: 8,	// 纵轴刻度字体大小
        legendColor: '595959', // legend颜色
        legendFontSize: 8,	// legend字体
        legendPos: 'b',	// legend位置 b 是底部，t 是顶部
        chartColors: chartColors, // 柱状图颜色列表
        showValue: true, // 是否展示数值
        dataLabelColor: '595959', // 数值字体颜色
        dataLabelFontFace: 'Microsoft YaHei', // 数值字体
        dataLabelFontSize: 6,	 // 数值字体大小
        dataLabelPosition: 'outEnd' // 数值出现位置
      }
    },
    initOptsTable() {
      return {
        x: 1,
        y: 1.0,
        w: '75%',
        h: '80%',
        rowH: 0.2, // 单元格默认高度
        valign: 'middle',
        fontSize: 8,
        color: '666666',
        align: 'center',
        border: { pt: 1, color: 'ffffff' }
      }
    },
    initOptsTableRow(valign, border, fill, color) {
      return { valign: valign, border: border, fill: fill, color: color }
    },
    initOptsPie(title, titleColor, chartColors) {
      return {
        x: 2.5,
        y: 1.2,
        w: 5.5,
        h: 3.4,
        chartArea: { fill: { color: 'F1F1F1' }},
        // holeSize: 10,
        // showLabel: true,
        // showValue: true,
        showPercent: true,
        showLegend: true,
        legendPos: 'b',
        //
        chartColors: chartColors,
        dataBorder: { pt: '1', color: 'F1F1F1' },
        dataLabelColor: '000000',
        dataLabelFontSize: 8,
        // dataLabelPosition: "bestFit",
        //
        showTitle: false,
        title: title,
        titleColor: titleColor,
        titleFontFace: 'Microsoft YaHei',
        titleFontSize: 19.2
      }
    },
    initOptCombo(chartColors) {
      return {
        x: 1,
        y: 1.2,
        w: '75%',
        h: 3.4,
        chartArea: { fill: { color: 'F1F1F1' }},
        barDir: 'col',
        barGrouping: 'stacked',
        catAxisLabelColor: '595959',
        catAxisLabelFontFace: 'Arial',
        catAxisLabelFontSize: 12,
        catAxisOrientation: 'minMax',
        showLegend: true,
        legendPos: 'b',
        showTitle: false,
        showValue: true // 是否展示数值
        // valAxisMaxVal: 100,
        // valAxisMajorUnit: 10
      }
    },
    initOptCombo2(chartColors, valAxisTitle, valAxisTitle1) {
      return {
        x: 1,
        y: 1.2,
        w: '75%',
        h: 3.4,
        chartArea: { fill: { color: 'F1F1F1' }},
        barDir: 'col',
        barGrouping: 'stacked',
        catAxisLabelColor: '595959',
        catAxisLabelFontFace: 'Arial',
        catAxisLabelFontSize: 12,
        catAxisOrientation: 'minMax',
        showLegend: true,
        legendPos: 'b',
        showTitle: false,
        showValue: true, // 是否展示数值
        valAxes: [
          {
            showValAxisTitle: true,
            // valAxisTitle: '分钟',
            valAxisTitle: valAxisTitle,
            // valAxisMaxVal: 10,
            valAxisTitleColor: '1982c4',
            valAxisLabelColor: '1982c4'
          },
          {
            showValAxisTitle: true,
            // valAxisTitle: '达标率 (%)',
            valAxisTitle: valAxisTitle1,
            valAxisMaxVal: 100,
            valAxisTitleColor: 'F38940',
            valAxisLabelColor: 'F38940',
            valGridLine: { style: 'none' }
          }
        ],
        catAxes: [{ catAxisTitle: 'Year' }, { catAxisHidden: true }]
      }
    },
    flushData() {
      this.dataAll = {
        qyzybltj: {// 全院转院病例统计
          chartType: '',
          labels: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: [],
            values: []
          }, {
            name: '',
            labels: [],
            values: []
          }]
        },
        qyzyblly: {// 全院转院病例来源统计
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        qyzyblly2: {// 全院转院病例去向统计
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),

          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        zdfbqktj: {// 1.诊断类型分布情况统计
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        qtfbqktj: {// 2.其他诊断类型分布情况
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        rsls: { // 3.溶栓例数（全院）
          chartType: '',
          labels: '',
          data2: [{
            name: '院前',
            labels: [],
            values: []
          }, {
            name: '院内',
            labels: [],
            values: []
          }]
        },
        pcibtcz: { // 4.PCI不同操作的手术治疗量统计
          chartType: '',
          labels: '',
          data2: [{
            name: '植入支架',
            labels: [],
            values: []
          }, {
            name: 'PTCA',
            labels: [],
            values: []
          }, {
            name: '冠脉内溶栓',
            labels: [],
            values: []
          }, {
            name: '血栓抽吸',
            labels: [],
            values: []
          }
          ]
        },
        sszllfb: {// 5.手术治疗量分布
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        zxlyD2Btime: {// 6.自行来院D2B平均时间排名
          chartType: '',
          labels: '',
          data: [{
            name: '分钟',
            labels: [],
            values: []
          }]
        },
        zxlyD2BshotTime: {// 7.自行来院D2B耗时最短病例（TOP5）
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        zxlyD2BlongTime: {// 8.自行来院D2B耗时最长病例（TOP5）
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        rxxlyD2Btime: { // 9.绕行病例D2B平均时间排名
          chartType: '',
          labels: '',
          data: [{
            name: '',
            labels: [],
            values: []
          }]
        },
        rxlyD2BshotTime: {// 10.绕行D2B耗时最短病例（TOP5）
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        rxlyD2BlongTime: {// 11.绕行D2B耗时最长病例（TOP5）
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        yczblist: {// 12.异常（超标/不达标）指标列表
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        sbwcslqs: { // 1.上报完成数量趋势图
          chartType: '',
          data: [{
            name: '上报完成数量',
            labels: [],
            values: []
          }]
        },
        sbpjhsqs: { // 2.上报平均耗时趋势图
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        tbqkfb: { // 3.填报情况分布图
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        zzsbqk: { // 4.最终上报情况分布图
          chartType: '',
          data1: [{
            name: '',
            labels: [],
            values: []
          }],
          data2: [{
            name: '',
            labels: ['总计'],
            values: []
          }]
        },
        kstblpm: { // 5.科室填报量排名
          chartType: '',
          labels: '',
          data: [{
            name: '',
            labels: [],
            values: []
          }]
        },
        ksjzsltj: { // 6.科室接诊数量统计
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        },
        cqjdsbyj: { // 7.超期建档上报预警
          chartType: '',
          options1: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], '4874cb', 'ffffff'),
          options2: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'cfd6ec', '000000'),
          options3: this.initOptsTableRow('middle', [ // 表格边框
            { pt: 1, color: 'ffffff' }
          ], 'e9ecf6', '000000'),
          data: []
        }
      }
    },
    async fetchImage1() {
      const response = await fetch(this.ppt1)
      const blob = await response.blob()
      const reader = new FileReader()
      reader.onloadend = async() => {
        this.ppt1_data = reader.result
      }
      reader.readAsDataURL(blob)
    },
    async fetchImage2() {
      const response = await fetch(this.ppt2)
      const blob = await response.blob()
      const reader = new FileReader()
      reader.onloadend = async() => {
        this.ppt2_data = reader.result
      }
      reader.readAsDataURL(blob)
    },
    async fetchImage3() {
      const response = await fetch(this.ppt3)
      const blob = await response.blob()
      const reader = new FileReader()
      reader.onloadend = async() => {
        this.ppt3_data = reader.result
      }
      reader.readAsDataURL(blob)
    },
    timeStamp(StatusMinute) {
      var day = parseInt(StatusMinute / 60 / 24)
      var hour = parseInt(StatusMinute / 60 % 24)
      var min = parseInt(StatusMinute % 60)
      StatusMinute = ''
      if (day > 0) {
        StatusMinute = day + '天'
      }
      if (hour > 0) {
        StatusMinute += hour + '小时'
      }
      if (min > 0) {
        StatusMinute += parseFloat(min) + '分钟'
      }
      return StatusMinute
    },
    getTransferred() {
      getHospitalTransfer({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange[0] ? this.monthRange[0] : '',
        endTime: this.monthRange[1] ? this.monthRange[1] : ''
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const transferInList = []
            const transferOutList = []
            const transferInOutList = []
            if (res.data.transferInOutNumList && res.data.transferInOutNumList.length > 0) {
              res.data.transferInOutNumList.forEach(el => {
                const timeData = el.year + '-' + el.month
                timeLine.push(timeData)
                transferInList.push(el.transferInNum ? el.transferInNum : 0)
                transferOutList.push(el.transferOutNum ? el.transferOutNum : 0)
                transferInOutList.push(el.transferInOutNum ? el.transferInOutNum : 0)
              })

              this.dataAll.qyzybltj.labels = timeLine
              // console.log(this.dataAll.qyzybltj.labels, 'this.dataAll.qyzybltj.labels')
              this.dataAll.qyzybltj.data1[0].values = transferInOutList
              this.dataAll.qyzybltj.data1[0].labels = this.dataAll.qyzybltj.labels
              this.dataAll.qyzybltj.data2[0].values = transferInList
              this.dataAll.qyzybltj.data2[0].labels = this.dataAll.qyzybltj.labels
              this.dataAll.qyzybltj.data2[1].values = transferOutList
              this.dataAll.qyzybltj.data2[1].labels = this.dataAll.qyzybltj.labels
            }
          }
        }
      })
    },
    getTransferredCasesIn() {
      this.tableInData = []
      // let transferredHospital = document.getElementById('transferred-cases-in')
      // let myChart = echarts.init(transferredHospital)
      // myChart.clear()
      // myChart.hideLoading()
      // window.addEventListener('resize', myChart.resize)
      getTransferInNums({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange[0] ? this.monthRange[0] : '',
        endTime: this.monthRange[1] ? this.monthRange[1] : ''
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            if (res.data.transferInHospitalNums && res.data.transferInHospitalNums.length > 0) {
              this.tableInData = res.data.transferInHospitalNums
              this.dataAll.qyzyblly.data = []
              let temp_data = []
              for (let i = 0; i < this.tableHeader1.length; i++) {
                temp_data.push(
                  {
                    text: this.tableHeader1[i],
                    options: this.dataAll.qyzyblly.options1
                  }
                )
              }
              this.dataAll.qyzyblly.data.push(temp_data)
              temp_data = []
              for (let i = 0; i < this.tableInData.length; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 0) {
                  temp_data.push({
                    text: this.tableInData[i].year + '-' + this.tableInData[i].month,
                    options: this.dataAll.qyzyblly.options2
                  })
                  temp_data.push({
                    text: this.tableInData[i].hospitalName,
                    options: this.dataAll.qyzyblly.options2
                  })
                  temp_data.push({
                    text: this.tableInData[i].transferInNum,
                    options: this.dataAll.qyzyblly.options2
                  })
                  temp_data.push({
                    text: this.tableInData[i].transferPercentage,
                    options: this.dataAll.qyzyblly.options2
                  })
                } else {
                  temp_data.push({
                    text: this.tableInData[i].year + '-' + this.tableInData[i].month,
                    options: this.dataAll.qyzyblly.options3
                  })
                  temp_data.push({
                    text: this.tableInData[i].hospitalName,
                    options: this.dataAll.qyzyblly.options3
                  })
                  temp_data.push({
                    text: this.tableInData[i].transferInNum,
                    options: this.dataAll.qyzyblly.options3
                  })
                  temp_data.push({
                    text: this.tableInData[i].transferPercentage,
                    options: this.dataAll.qyzyblly.options3
                  })
                }
                this.dataAll.qyzyblly.data.push(temp_data)
              }
            }
          }
        }
      })
    },
    getTransferredCasesOut() {
      this.tableOutData = []
      getTransferOutNums({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange[0] ? this.monthRange[0] : '',
        endTime: this.monthRange[1] ? this.monthRange[1] : ''
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            if (res.data.transferOutHospitalNums && res.data.transferOutHospitalNums.length > 0) {
              this.tableOutData = res.data.transferOutHospitalNums
              this.dataAll.qyzyblly2.data = []
              let temp_data = []
              for (let i = 0; i < this.tableHeader2.length; i++) {
                temp_data.push(
                  {
                    text: this.tableHeader2[i],
                    options: this.dataAll.qyzyblly2.options1
                  }
                )
              }
              // console.log(this.tableOutData)
              this.dataAll.qyzyblly2.data.push(temp_data)
              temp_data = []
              for (let i = 0; i < this.tableOutData.length; i++) {
                temp_data = []
                if (i === 0 || i % 2 === 0) {
                  temp_data.push({
                    text: this.tableOutData[i].year + '-' + this.tableOutData[i].month,
                    options: this.dataAll.qyzyblly2.options2
                  })
                  temp_data.push({
                    text: this.tableOutData[i].hospitalName,
                    options: this.dataAll.qyzyblly2.options2
                  })
                  temp_data.push({
                    text: this.tableOutData[i].transferOutNum,
                    options: this.dataAll.qyzyblly2.options2
                  })
                  temp_data.push({
                    text: this.tableOutData[i].transferPercentage,
                    options: this.dataAll.qyzyblly2.options2
                  })
                } else {
                  temp_data.push({
                    text: this.tableOutData[i].year + '-' + this.tableOutData[i].month,
                    options: this.dataAll.qyzyblly2.options3
                  })
                  temp_data.push({
                    text: this.tableOutData[i].hospitalName,
                    options: this.dataAll.qyzyblly2.options3
                  })
                  temp_data.push({
                    text: this.tableOutData[i].transferOutNum,
                    options: this.dataAll.qyzyblly2.options3
                  })
                  temp_data.push({
                    text: this.tableOutData[i].transferPercentage,
                    options: this.dataAll.qyzyblly2.options3
                  })
                }
                this.dataAll.qyzyblly2.data.push(temp_data)
              }
            }
          }
        }
      })
    }
  }
}
</script>
